threads / patch / 38855

patchgit=p4.py rebase now honor's client spec

Subject: [PATCH] git=p4.py rebase now honor's client spec

## tl;dr

3 messages between Mar 19, 2015 and Mar 20, 2015. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Sam Bishop· Mar 19, 2015, 12:28 UTC · lore

When using the git-p4.py script, I found that if I used a client spec when cloning out a perforce repository, and then using a git-p4.py rebase, that the rebase command would be using the current perforce client spec, instead of the one used when doing the initial clone. My proposed patch causes the rebase command to switch to the perforce client spec used when doing the initial git-p4.py clone.

This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.
From c66fbd5019a2b8b6452166868b33ce426f93d96f Mon Sep 17 00:00:00 2001
From: Sam Bishop <Sam.Bishop@blackboard.com>
Date: Wed, 18 Mar 2015 15:26:48 -0400
Subject: [PATCH] Git-p4 rebase command will now honor perforce client spec.
When specifiying a client spec while cloning a perforce repo
the name of the client spec will now be saved in the .git/config
file, so that it may be referenced later when doing a git p4 rebase.
---
 git-p4.py | 3 +++
 1 file changed, 3 insertions(+)
Show changes to git-p4.py +3 −0
diff --git a/git-p4.py b/git-p4.py
index ff132b2..f4f242a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1807,6 +1807,7 @@ class View(object):
         self.client_prefix = "//%s/" % client_name
         # cache results of "p4 where" to lookup client file locations
         self.client_spec_path_cache = {}
+        self.client_name = client_name
 
     def append(self, view_line):
         """Parse a view line, splitting it into depot and client
@@ -2787,6 +2788,7 @@ class P4Sync(Command, P4UserMap):
         else:
             if gitConfigBool("git-p4.useclientspec"):
                 self.useClientSpec = True
+                os.environ['P4CLIENT'] = gitConfig("git-p4.clientSpecName")
         if self.useClientSpec:
             self.clientSpecDirs = getClientSpec()
 
@@ -3177,6 +3179,7 @@ class P4Clone(P4Sync):
         # auto-set this variable if invoked with --use-client-spec
         if self.useClientSpec_from_options:
             system("git config --bool git-p4.useclientspec true")
+            system(["git", "config", "--add", "git-p4.clientSpecName", self.clientSpecDirs.client_name])
 
         return True
 
-- 
1.9.3 (Apple Git-50)
brian m. carlson· Mar 19, 2015, 21:58 UTC · re: Sam Bishop · lore

Re: [PATCH] git=p4.py rebase now honor's client spec

On Thu, Mar 19, 2015 at 12:28:09PM +0000, Sam Bishop wrote:
Show 13 quoted lines
> When using the git-p4.py script, I found that if I used a client spec when
> cloning out a perforce repository, and then using a git-p4.py rebase, that
> the rebase command would be using the current perforce client spec,
> instead of the one used when doing the initial clone. My proposed patch
> causes the rebase command to switch to the perforce client spec used when
> doing the initial git-p4.py clone.
> 
> This email and any attachments may contain confidential and
> proprietary information of Blackboard that is for the sole use of the
> intended recipient. If you are not the intended recipient, disclosure,
> copying, re-distribution or other use of any of this information is
> strictly prohibited. Please immediately notify the sender and delete
> this transmission if you received this email in error.

You might want to read Documentation/SubmittingPatches for information on patch submission procedures. Most notably, you'll need to sign-off your work to indicate that you can submit it under the appropriate license.

The confidentiality notice above is not only inappropriate for a public mailing list, it discourages people from even looking at your patch, as you just claimed it was confidential and proprietary and nobody wants to be sued.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Luke Diamand· Mar 20, 2015, 08:13 UTC · re: brian m. carlson · lore

Re: [PATCH] git=p4.py rebase now honor's client spec

On 19/03/15 21:58, brian m. carlson wrote:
Show 8 quoted lines
> On Thu, Mar 19, 2015 at 12:28:09PM +0000, Sam Bishop wrote:
>> When using the git-p4.py script, I found that if I used a client spec when
>> cloning out a perforce repository, and then using a git-p4.py rebase, that
>> the rebase command would be using the current perforce client spec,
>> instead of the one used when doing the initial clone. My proposed patch
>> causes the rebase command to switch to the perforce client spec used when
>> doing the initial git-p4.py clone.
>>

That's very useful, thanks. I've noticed that behaviour in the past and always thought it ought to be fixed. As Brian notes, it needs a "Signed-off" line in the patch.

A very small nit: could you prefix the subject with "git p4:" so that it's consistent with other recent git-p4 changes - it makes it easier to pick them out when reviewing changes.

Could you run the git-p4 unit tests on it please (t/t98*)? I could be wrong about this, but it looks to me like t9806-git-p4-options.sh doesn't pass now with this change (*)

Thanks! Luke

(*) There's at least one test that doesn't pass anyway, but this seems to be new.

← back to recent threads