git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] git p4: do wildcard decoding in stripRepoPath

From
PWPete Wyckoff <pw@padd.com>
Date
Aug 11, 2012, 16:55 UTC
Message-ID
<1344704104-17727-4-git-send-email-pw@padd.com>
In-Reply-To
<20120811165143.GA2004@padd.com>

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>
---
 git-p4.py | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index 6d07115..e20ff5d 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1819,15 +1819,17 @@ class P4Sync(Command, P4UserMap):
 
     def stripRepoPath(self, path, prefixes):
         if self.useClientSpec:
-            return self.clientSpecDirs.map_in_client(path)
+            path = self.clientSpecDirs.map_in_client(path)
 
-        if self.keepRepoPath:
-            prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
+        else:
+            if self.keepRepoPath:
+                prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
 
-        for p in prefixes:
-            if p4PathStartsWith(path, p):
-                path = path[len(p):]
+            for p in prefixes:
+                if p4PathStartsWith(path, p):
+                    path = path[len(p):]
 
+        path = wildcard_decode(path)
         return path
 
     def splitFilesIntoBranches(self, commit):
@@ -1849,7 +1851,6 @@ class P4Sync(Command, P4UserMap):
             fnum = fnum + 1
 
             relPath = self.stripRepoPath(path, self.depotPaths)
-            relPath = wildcard_decode(relPath)
 
             for branch in self.knownBranches.keys():
 
@@ -1867,7 +1868,6 @@ class P4Sync(Command, P4UserMap):
 
     def streamOneP4File(self, file, contents):
         relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
-        relPath = wildcard_decode(relPath)
         if verbose:
             sys.stderr.write("%s\n" % relPath)
 
@@ -1936,7 +1936,6 @@ class P4Sync(Command, P4UserMap):
 
     def streamOneP4Deletion(self, file):
         relPath = self.stripRepoPath(file['path'], self.branchPrefixes)
-        relPath = wildcard_decode(relPath)
         if verbose:
             sys.stderr.write("delete %s\n" % relPath)
         self.gitStream.write("D %s\n" % relPath)
-- 
1.7.12.rc2.24.gc304662
Previous: Pete WyckoffNext: Pete Wyckoff
Message 6 of 10 in “git-p4 migrates perforce “main” branch into git branches as subdirectories (doubled code in git branches)”
  1. Matthew KorichAug 10, 2012
  2. 0/5 git p4: fix branch detection with --use-client-specPete Wyckoff, Aug 11, 2012
  3. 1/5 git p4 test: move client_view() function to libraryPete Wyckoff, Aug 11, 2012
  4. 2/5 git p4 test: add broken --use-client-spec --detect-branches testsPete Wyckoff, Aug 11, 2012
  5. 3/5 git p4: set self.branchPrefixes in initializationPete Wyckoff, Aug 11, 2012
  6. 4/5 git p4: do wildcard decoding in stripRepoPathPete Wyckoff, Aug 11, 2012
  7. 5/5 git p4: make branch detection work with --use-client-specPete Wyckoff, Aug 11, 2012
  8. Junio C HamanoAug 12, 2012
  9. Pete WyckoffAug 12, 2012
  10. Junio C HamanoAug 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.