Skip to content

Commit 0d1696e

Browse files
Pete Wyckoffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e63231e commit 0d1696e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

git-p4.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,15 +1819,17 @@ def extractFilesFromCommit(self, commit):
18191819

18201820
def stripRepoPath(self, path, prefixes):
18211821
if self.useClientSpec:
1822-
return self.clientSpecDirs.map_in_client(path)
1822+
path = self.clientSpecDirs.map_in_client(path)
18231823

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])]
18261827

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):]
18301831

1832+
path = wildcard_decode(path)
18311833
return path
18321834

18331835
def splitFilesIntoBranches(self, commit):
@@ -1849,7 +1851,6 @@ def splitFilesIntoBranches(self, commit):
18491851
fnum = fnum + 1
18501852

18511853
relPath = self.stripRepoPath(path, self.depotPaths)
1852-
relPath = wildcard_decode(relPath)
18531854

18541855
for branch in self.knownBranches.keys():
18551856

@@ -1867,7 +1868,6 @@ def splitFilesIntoBranches(self, commit):
18671868

18681869
def streamOneP4File(self, file, contents):
18691870
relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
1870-
relPath = wildcard_decode(relPath)
18711871
if verbose:
18721872
sys.stderr.write("%s\n" % relPath)
18731873

@@ -1936,7 +1936,6 @@ def streamOneP4File(self, file, contents):
19361936

19371937
def streamOneP4Deletion(self, file):
19381938
relPath = self.stripRepoPath(file['path'], self.branchPrefixes)
1939-
relPath = wildcard_decode(relPath)
19401939
if verbose:
19411940
sys.stderr.write("delete %s\n" % relPath)
19421941
self.gitStream.write("D %s\n" % relPath)

0 commit comments

Comments
 (0)