git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled
@ 2012-08-20 23:43 Patrick C. McGinty
  2012-08-22 21:22 ` Pete Wyckoff
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick C. McGinty @ 2012-08-20 23:43 UTC (permalink / raw)
  To: casey.mcginty, git

From: "Patrick C. McGinty" <casey.mcginty@gmail.com>

This removes the branch names from being included in the file system
path when using the both --use-client-spec and --detect-branches
options.

Used alone, the --detect-branches option did the right thing, removing
the branch names from the relative git path. By adding the
--use-client-spec option, the old logic would incorrectly bypass this
step.

Signed-off-by: Patrick C. McGinty <casey.mcginty@gmail.com>
---
 git-p4.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/git-p4.py b/git-p4.py
index e67d37d..9489845 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1819,7 +1819,15 @@ class P4Sync(Command, P4UserMap):
 
     def stripRepoPath(self, path, prefixes):
         if self.useClientSpec:
-            return self.clientSpecDirs.map_in_client(path)
+            # map path to user defined client location
+            path = self.clientSpecDirs.map_in_client(path)
+            # Remove prefixes (e.g. branch names) from path. Apply the
+            # clientSpecDirs map to the prefix paths to match the
+            # modified path value.
+            for p in map(self.clientSpecDirs.map_in_client, prefixes):
+               if p and p4PathStartsWith( path, p):
+                  path = path[len(p):]
+            return path
 
         if self.keepRepoPath:
             prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled
  2012-08-20 23:43 [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled Patrick C. McGinty
@ 2012-08-22 21:22 ` Pete Wyckoff
  0 siblings, 0 replies; 2+ messages in thread
From: Pete Wyckoff @ 2012-08-22 21:22 UTC (permalink / raw)
  To: Patrick C. McGinty; +Cc: git

casey.mcginty@gmail.com wrote on Mon, 20 Aug 2012 13:43 -1000:
> This removes the branch names from being included in the file system
> path when using the both --use-client-spec and --detect-branches
> options.
> 
> Used alone, the --detect-branches option did the right thing, removing
> the branch names from the relative git path. By adding the
> --use-client-spec option, the old logic would incorrectly bypass this
> step.

Thanks for reporting this bug, and supplying a fix.  I think,
though that this is the same issue we were looking at in this
thread:

    http://article.gmane.org/gmane.comp.version-control.git/203294

It is queued up and the fix likely will appear in 1.7.13 (or
whatever the next release after 1.7.12 is called).

(Gmane has been down all day from here; there's information from
another reporter in http://stackoverflow.com/questions/11893688/ .)

		-- Pete

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-22 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 23:43 [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled Patrick C. McGinty
2012-08-22 21:22 ` Pete Wyckoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).