diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-07-28 14:45:12 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-04 11:00:07 -0700 |
commit | 60c5939b236723cb43344115eed03caf8de2b22a (patch) | |
tree | 43071e9ebc5955e697fadd1b8d4da0c13824c3d9 /org.eclipse.jgit.test | |
parent | 7514a6dbdc1c69a885d900385d0d9f5b40224c2f (diff) | |
download | jgit-60c5939b236723cb43344115eed03caf8de2b22a.tar.gz jgit-60c5939b236723cb43344115eed03caf8de2b22a.zip |
Rename getOldName,getNewName to getOldPath,getNewPath
TreeWalk calls this value "path", while "name" is the stuff after the
last slash. FileHeader should do the same thing to be consistent.
Rename getOldName to getOldPath and getNewName to getNewPath.
Bug: 318526
Change-Id: Ib2e372ad4426402d37939b48d8f233154cc637da
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
6 files changed, 72 insertions, 72 deletions
diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java index ae9fb0ef50..ff442b6188 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java @@ -108,9 +108,9 @@ public class EGitPatchHistoryTest extends TestCase { for (final FileHeader fh : p.getFiles()) { final String fileName; if (fh.getChangeType() != FileHeader.ChangeType.DELETE) - fileName = fh.getNewName(); + fileName = fh.getNewPath(); else - fileName = fh.getOldName(); + fileName = fh.getOldPath(); final StatInfo s = files.remove(fileName); final String nid = fileName + " in " + cid; assertNotNull("No " + nid, s); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java index 37c9d2fb77..26116d2504 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java @@ -498,10 +498,10 @@ public class RenameDetectorTest extends RepositoryTestCase { assertEquals(1, entries.size()); DiffEntry modify = entries.get(0); - assertEquals(m.oldName, modify.oldName); + assertEquals(m.oldPath, modify.oldPath); assertEquals(m.oldId, modify.oldId); assertEquals(m.oldMode, modify.oldMode); - assertEquals(m.newName, modify.newName); + assertEquals(m.newPath, modify.newPath); assertEquals(m.newId, modify.newId); assertEquals(m.newMode, modify.newMode); assertEquals(m.changeType, modify.changeType); @@ -560,8 +560,8 @@ public class RenameDetectorTest extends RepositoryTestCase { DiffEntry rename) { assertEquals(ChangeType.RENAME, rename.getChangeType()); - assertEquals(o.getOldName(), rename.getOldName()); - assertEquals(n.getNewName(), rename.getNewName()); + assertEquals(o.getOldPath(), rename.getOldPath()); + assertEquals(n.getNewPath(), rename.getNewPath()); assertEquals(o.getOldMode(), rename.getOldMode()); assertEquals(n.getNewMode(), rename.getNewMode()); @@ -576,8 +576,8 @@ public class RenameDetectorTest extends RepositoryTestCase { DiffEntry copy) { assertEquals(ChangeType.COPY, copy.getChangeType()); - assertEquals(o.getOldName(), copy.getOldName()); - assertEquals(n.getNewName(), copy.getNewName()); + assertEquals(o.getOldPath(), copy.getOldPath()); + assertEquals(n.getNewPath(), copy.getNewPath()); assertEquals(o.getOldMode(), copy.getOldMode()); assertEquals(n.getNewMode(), copy.getNewMode()); @@ -590,11 +590,11 @@ public class RenameDetectorTest extends RepositoryTestCase { private static void assertAdd(String newName, ObjectId newId, FileMode newMode, DiffEntry add) { - assertEquals(DiffEntry.DEV_NULL, add.oldName); + assertEquals(DiffEntry.DEV_NULL, add.oldPath); assertEquals(DiffEntry.A_ZERO, add.oldId); assertEquals(FileMode.MISSING, add.oldMode); assertEquals(ChangeType.ADD, add.changeType); - assertEquals(newName, add.newName); + assertEquals(newName, add.newPath); assertEquals(AbbreviatedObjectId.fromObjectId(newId), add.newId); assertEquals(newMode, add.newMode); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/FileHeaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/FileHeaderTest.java index 17e99779cf..813a701eaf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/FileHeaderTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/FileHeaderTest.java @@ -79,16 +79,16 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = header(name); assertEquals(gitLine(name).length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } public void testParseGitFileName_FailFooBar() { final FileHeader fh = data("a/foo b/bar\n-"); assertTrue(fh.parseGitFileName(0, fh.buf.length) > 0); - assertNull(fh.getOldName()); - assertNull(fh.getNewName()); + assertNull(fh.getOldPath()); + assertNull(fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -97,8 +97,8 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = header(name); assertEquals(gitLine(name).length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -108,8 +108,8 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = dqHeader(dqName); assertEquals(dqGitLine(dqName).length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -119,8 +119,8 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = dqHeader(dqName); assertEquals(dqGitLine(dqName).length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -129,8 +129,8 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = header(name); assertEquals(gitLine(name).length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -139,8 +139,8 @@ public class FileHeaderTest extends TestCase { final String header = "project-v-1.0/" + name + " mydev/" + name + "\n"; final FileHeader fh = data(header + "-"); assertEquals(header.length(), fh.parseGitFileName(0, fh.buf.length)); - assertEquals(name, fh.getOldName()); - assertSame(fh.getOldName(), fh.getNewName()); + assertEquals(name, fh.getOldPath()); + assertSame(fh.getOldPath(), fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); } @@ -153,9 +153,9 @@ public class FileHeaderTest extends TestCase { + "@@ -0,0 +1 @@\n" + "+a\n"); assertParse(fh); - assertEquals("/dev/null", fh.getOldName()); - assertSame(DiffEntry.DEV_NULL, fh.getOldName()); - assertEquals("\u00c5ngstr\u00f6m", fh.getNewName()); + assertEquals("/dev/null", fh.getOldPath()); + assertSame(DiffEntry.DEV_NULL, fh.getOldPath()); + assertEquals("\u00c5ngstr\u00f6m", fh.getNewPath()); assertSame(FileHeader.ChangeType.ADD, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -178,9 +178,9 @@ public class FileHeaderTest extends TestCase { + "@@ -1 +0,0 @@\n" + "-a\n"); assertParse(fh); - assertEquals("\u00c5ngstr\u00f6m", fh.getOldName()); - assertEquals("/dev/null", fh.getNewName()); - assertSame(DiffEntry.DEV_NULL, fh.getNewName()); + assertEquals("\u00c5ngstr\u00f6m", fh.getOldPath()); + assertEquals("/dev/null", fh.getNewPath()); + assertSame(DiffEntry.DEV_NULL, fh.getNewPath()); assertSame(FileHeader.ChangeType.DELETE, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -198,8 +198,8 @@ public class FileHeaderTest extends TestCase { final FileHeader fh = data("diff --git a/a b b/a b\n" + "old mode 100644\n" + "new mode 100755\n"); assertParse(fh); - assertEquals("a b", fh.getOldName()); - assertEquals("a b", fh.getNewName()); + assertEquals("a b", fh.getOldPath()); + assertEquals("a b", fh.getNewPath()); assertSame(FileHeader.ChangeType.MODIFY, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -220,14 +220,14 @@ public class FileHeaderTest extends TestCase { + "rename to \" c/\\303\\205ngstr\\303\\266m\"\n"); int ptr = fh.parseGitFileName(0, fh.buf.length); assertTrue(ptr > 0); - assertNull(fh.getOldName()); // can't parse names on a rename - assertNull(fh.getNewName()); + assertNull(fh.getOldPath()); // can't parse names on a rename + assertNull(fh.getNewPath()); ptr = fh.parseGitHeaders(ptr, fh.buf.length); assertTrue(ptr > 0); - assertEquals("a", fh.getOldName()); - assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewPath()); assertSame(FileHeader.ChangeType.RENAME, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -249,14 +249,14 @@ public class FileHeaderTest extends TestCase { + "rename new \" c/\\303\\205ngstr\\303\\266m\"\n"); int ptr = fh.parseGitFileName(0, fh.buf.length); assertTrue(ptr > 0); - assertNull(fh.getOldName()); // can't parse names on a rename - assertNull(fh.getNewName()); + assertNull(fh.getOldPath()); // can't parse names on a rename + assertNull(fh.getNewPath()); ptr = fh.parseGitHeaders(ptr, fh.buf.length); assertTrue(ptr > 0); - assertEquals("a", fh.getOldName()); - assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewPath()); assertSame(FileHeader.ChangeType.RENAME, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -278,14 +278,14 @@ public class FileHeaderTest extends TestCase { + "copy to \" c/\\303\\205ngstr\\303\\266m\"\n"); int ptr = fh.parseGitFileName(0, fh.buf.length); assertTrue(ptr > 0); - assertNull(fh.getOldName()); // can't parse names on a copy - assertNull(fh.getNewName()); + assertNull(fh.getOldPath()); // can't parse names on a copy + assertNull(fh.getNewPath()); ptr = fh.parseGitHeaders(ptr, fh.buf.length); assertTrue(ptr > 0); - assertEquals("a", fh.getOldName()); - assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals(" c/\u00c5ngstr\u00f6m", fh.getNewPath()); assertSame(FileHeader.ChangeType.COPY, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); @@ -307,8 +307,8 @@ public class FileHeaderTest extends TestCase { + ".." + nid + " 100644\n" + "--- a/a\n" + "+++ b/a\n"); assertParse(fh); - assertEquals("a", fh.getOldName()); - assertEquals("a", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals("a", fh.getNewPath()); assertSame(FileMode.REGULAR_FILE, fh.getOldMode()); assertSame(FileMode.REGULAR_FILE, fh.getNewMode()); @@ -331,8 +331,8 @@ public class FileHeaderTest extends TestCase { + ".." + nid + "\n" + "--- a/a\n" + "+++ b/a\n"); assertParse(fh); - assertEquals("a", fh.getOldName()); - assertEquals("a", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals("a", fh.getNewPath()); assertFalse(fh.hasMetaDataChanges()); assertNull(fh.getOldMode()); @@ -357,8 +357,8 @@ public class FileHeaderTest extends TestCase { + " 100644\n" + "--- a/a\n" + "+++ b/a\n"); assertParse(fh); - assertEquals("a", fh.getOldName()); - assertEquals("a", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals("a", fh.getNewPath()); assertSame(FileMode.REGULAR_FILE, fh.getOldMode()); assertSame(FileMode.REGULAR_FILE, fh.getNewMode()); @@ -386,8 +386,8 @@ public class FileHeaderTest extends TestCase { + "\n" + "--- a/a\n" + "+++ b/a\n"); assertParse(fh); - assertEquals("a", fh.getOldName()); - assertEquals("a", fh.getNewName()); + assertEquals("a", fh.getOldPath()); + assertEquals("a", fh.getNewPath()); assertNull(fh.getOldMode()); assertNull(fh.getNewMode()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcTest.java index 1d879cba67..cef13f5f16 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcTest.java @@ -60,8 +60,8 @@ public class PatchCcTest extends TestCase { final CombinedFileHeader cfh = (CombinedFileHeader) p.getFiles().get(0); assertEquals("org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java", - cfh.getNewName()); - assertEquals(cfh.getNewName(), cfh.getOldName()); + cfh.getNewPath()); + assertEquals(cfh.getNewPath(), cfh.getOldPath()); assertEquals(98, cfh.startOffset); @@ -114,8 +114,8 @@ public class PatchCcTest extends TestCase { final CombinedFileHeader cfh = (CombinedFileHeader) p.getFiles().get(0); - assertSame(DiffEntry.DEV_NULL, cfh.getOldName()); - assertEquals("d", cfh.getNewName()); + assertSame(DiffEntry.DEV_NULL, cfh.getOldPath()); + assertEquals("d", cfh.getNewPath()); assertEquals(187, cfh.startOffset); @@ -168,8 +168,8 @@ public class PatchCcTest extends TestCase { final CombinedFileHeader cfh = (CombinedFileHeader) p.getFiles().get(0); - assertEquals("a", cfh.getOldName()); - assertSame(DiffEntry.DEV_NULL, cfh.getNewName()); + assertEquals("a", cfh.getOldPath()); + assertSame(DiffEntry.DEV_NULL, cfh.getNewPath()); assertEquals(187, cfh.startOffset); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchErrorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchErrorTest.java index 62a107130e..67b3f5c589 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchErrorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchErrorTest.java @@ -56,7 +56,7 @@ public class PatchErrorTest extends TestCase { final FileHeader fh = p.getFiles().get(0); assertEquals( "org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java", - fh.getNewName()); + fh.getNewPath()); assertEquals(1, fh.getHunks().size()); } @@ -114,14 +114,14 @@ public class PatchErrorTest extends TestCase { final FileHeader fh = p.getFiles().get(0); assertEquals( "org.eclipse.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java", - fh.getNewName()); + fh.getNewPath()); assertEquals(1, fh.getHunks().size()); } { final FileHeader fh = p.getFiles().get(1); assertEquals( "org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java", - fh.getNewName()); + fh.getNewPath()); assertEquals(1, fh.getHunks().size()); } @@ -139,7 +139,7 @@ public class PatchErrorTest extends TestCase { { final FileHeader fh = p.getFiles().get(0); assertEquals("org.spearce.egit.ui/icons/toolbar/fetchd.png", fh - .getNewName()); + .getNewPath()); assertSame(FileHeader.PatchType.GIT_BINARY, fh.getPatchType()); assertTrue(fh.getHunks().isEmpty()); assertNull(fh.getForwardBinaryHunk()); @@ -147,7 +147,7 @@ public class PatchErrorTest extends TestCase { { final FileHeader fh = p.getFiles().get(1); assertEquals("org.spearce.egit.ui/icons/toolbar/fetche.png", fh - .getNewName()); + .getNewPath()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); assertTrue(fh.getHunks().isEmpty()); assertNull(fh.getForwardBinaryHunk()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchTest.java index 52d6e27ca8..dd76251385 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchTest.java @@ -68,11 +68,11 @@ public class PatchTest extends TestCase { assertEquals( "org.eclipse.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java", - fRepositoryConfigTest.getNewName()); + fRepositoryConfigTest.getNewPath()); assertEquals( "org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java", - fRepositoryConfig.getNewName()); + fRepositoryConfig.getNewPath()); assertEquals(572, fRepositoryConfigTest.startOffset); assertEquals(1490, fRepositoryConfig.startOffset); @@ -168,7 +168,7 @@ public class PatchTest extends TestCase { assertEquals("0000000", fh.getOldId().name()); assertSame(FileMode.MISSING, fh.getOldMode()); assertSame(FileMode.REGULAR_FILE, fh.getNewMode()); - assertTrue(fh.getNewName().startsWith( + assertTrue(fh.getNewPath().startsWith( "org.spearce.egit.ui/icons/toolbar/")); assertSame(FileHeader.PatchType.BINARY, fh.getPatchType()); assertTrue(fh.getHunks().isEmpty()); @@ -179,7 +179,7 @@ public class PatchTest extends TestCase { } final FileHeader fh = p.getFiles().get(4); - assertEquals("org.spearce.egit.ui/plugin.xml", fh.getNewName()); + assertEquals("org.spearce.egit.ui/plugin.xml", fh.getNewPath()); assertSame(FileHeader.ChangeType.MODIFY, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); assertFalse(fh.hasMetaDataChanges()); @@ -203,7 +203,7 @@ public class PatchTest extends TestCase { assertNotNull(fh.getNewId()); assertEquals(ObjectId.zeroId().name(), fh.getOldId().name()); assertSame(FileMode.REGULAR_FILE, fh.getNewMode()); - assertTrue(fh.getNewName().startsWith( + assertTrue(fh.getNewPath().startsWith( "org.spearce.egit.ui/icons/toolbar/")); assertSame(FileHeader.PatchType.GIT_BINARY, fh.getPatchType()); assertTrue(fh.getHunks().isEmpty()); @@ -224,7 +224,7 @@ public class PatchTest extends TestCase { } final FileHeader fh = p.getFiles().get(4); - assertEquals("org.spearce.egit.ui/plugin.xml", fh.getNewName()); + assertEquals("org.spearce.egit.ui/plugin.xml", fh.getNewPath()); assertSame(FileHeader.ChangeType.MODIFY, fh.getChangeType()); assertSame(FileHeader.PatchType.UNIFIED, fh.getPatchType()); assertFalse(fh.hasMetaDataChanges()); @@ -241,7 +241,7 @@ public class PatchTest extends TestCase { assertTrue(p.getErrors().isEmpty()); final FileHeader fh = p.getFiles().get(0); - assertTrue(fh.getNewName().startsWith("zero.bin")); + assertTrue(fh.getNewPath().startsWith("zero.bin")); assertSame(FileHeader.ChangeType.MODIFY, fh.getChangeType()); assertSame(FileHeader.PatchType.GIT_BINARY, fh.getPatchType()); assertSame(FileMode.REGULAR_FILE, fh.getNewMode()); @@ -279,7 +279,7 @@ public class PatchTest extends TestCase { final FileHeader f = p.getFiles().get(0); - assertEquals("a", f.getNewName()); + assertEquals("a", f.getNewPath()); assertEquals(252, f.startOffset); assertEquals("2e65efe", f.getOldId().name()); @@ -313,7 +313,7 @@ public class PatchTest extends TestCase { final FileHeader f = p.getFiles().get(0); - assertEquals("a", f.getNewName()); + assertEquals("a", f.getNewPath()); assertEquals(256, f.startOffset); assertEquals("f2ad6c7", f.getOldId().name()); |