git p4: do wildcard decoding in stripRepoPath

Instead of having to remember to do it after each call to stripRepoPath, make it part of that function. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Aug 11, 2012 at 12:55 UTC 0d1696ef47a61bba1088b0e5cd58a8bc45d936fb
1 file changed +8 -9
git-p4.py
+8 -9
@@ -1819,15 +1819,17 @@ class P4Sync(Command, P4UserMap):
1819
1820 def stripRepoPath(self, path, prefixes):
1821 if self.useClientSpec:
1822 - return self.clientSpecDirs.map_in_client(path)
1822 + path = self.clientSpecDirs.map_in_client(path)
1823
1824 - if self.keepRepoPath:
1825 - prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
1824 + else:
1825 + if self.keepRepoPath:
1826 + prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
1827
1827 - for p in prefixes:
1828 - if p4PathStartsWith(path, p):
1829 - path = path[len(p):]
1828 + for p in prefixes:
1829 + if p4PathStartsWith(path, p):
1830 + path = path[len(p):]
1831
1832 + path = wildcard_decode(path)
1833 return path
1834
1835 def splitFilesIntoBranches(self, commit):
@@ -1849,7 +1851,6 @@ class P4Sync(Command, P4UserMap):
1851 fnum = fnum + 1
1852
1853 relPath = self.stripRepoPath(path, self.depotPaths)
1852 - relPath = wildcard_decode(relPath)
1854
1855 for branch in self.knownBranches.keys():
1856
@@ -1867,7 +1868,6 @@ class P4Sync(Command, P4UserMap):
1868
1869 def streamOneP4File(self, file, contents):
1870 relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
1870 - relPath = wildcard_decode(relPath)
1871 if verbose:
1872 sys.stderr.write("%s\n" % relPath)
1873
@@ -1936,7 +1936,6 @@ class P4Sync(Command, P4UserMap):
1936
1937 def streamOneP4Deletion(self, file):
1938 relPath = self.stripRepoPath(file['path'], self.branchPrefixes)
1939 - relPath = wildcard_decode(relPath)
1939 if verbose:
1940 sys.stderr.write("delete %s\n" % relPath)
1941 self.gitStream.write("D %s\n" % relPath)