* [PATCH] git-p4: small improvements to user-preservation
@ 2011-05-07 10:19 Luke Diamand
2011-05-07 10:19 ` Luke Diamand
0 siblings, 1 reply; 3+ messages in thread
From: Luke Diamand @ 2011-05-07 10:19 UTC (permalink / raw)
To: git; +Cc: Pete Wyckoff, Luke Diamand
. Slightly more paranoid checking of results from 'p4 change'
. Remove superfluous "-G"
. Don't modify the username if it is unchanged.
. Add a comment in the change template to show what is
going to be done.
Luke Diamand (1):
git-p4: small improvements to user-preservation
contrib/fast-import/git-p4 | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] git-p4: small improvements to user-preservation
2011-05-07 10:19 [PATCH] git-p4: small improvements to user-preservation Luke Diamand
@ 2011-05-07 10:19 ` Luke Diamand
2011-05-09 4:50 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Luke Diamand @ 2011-05-07 10:19 UTC (permalink / raw)
To: git; +Cc: Pete Wyckoff, Luke Diamand
. Slightly more paranoid checking of results from 'p4 change'
. Remove superfluous "-G"
. Don't modify the username if it is unchanged.
. Add a comment in the change template to show what is
going to be done.
Signed-off-by: Luke Diamand <luke@diamand.org>
---
contrib/fast-import/git-p4 | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 36e3d87..e66a7df 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -690,10 +690,15 @@ class P4Submit(Command, P4UserMap):
def modifyChangelistUser(self, changelist, newUser):
# fixup the user field of a changelist after it has been submitted.
changes = p4CmdList("change -o %s" % changelist)
- for c in changes:
- if c.has_key('User'):
- c['User'] = newUser
- input = marshal.dumps(changes[0])
+ if len(changes) != 1:
+ die("Bad output from p4 change modifying %s to user %s" %
+ (changelist, newUser))
+
+ c = changes[0]
+ if c['User'] == newUser: return # nothing to do
+ c['User'] = newUser
+ input = marshal.dumps(c)
+
result = p4CmdList("change -f -i", stdin=input)
for r in result:
if r.has_key('code'):
@@ -707,7 +712,7 @@ class P4Submit(Command, P4UserMap):
def canChangeChangelists(self):
# check to see if we have p4 admin or super-user permissions, either of
# which are required to modify changelists.
- results = p4CmdList("-G protects %s" % self.depotPath)
+ results = p4CmdList("protects %s" % self.depotPath)
for r in results:
if r.has_key('perm'):
if r['perm'] == 'admin':
@@ -865,6 +870,10 @@ class P4Submit(Command, P4UserMap):
if self.interactive:
submitTemplate = self.prepareLogMessage(template, logMessage)
+
+ if self.preserveUser:
+ submitTemplate = submitTemplate + ("\n######## Actual user %s, modified after commit\n" % p4User)
+
if os.environ.has_key("P4DIFF"):
del(os.environ["P4DIFF"])
diff = ""
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-p4: small improvements to user-preservation
2011-05-07 10:19 ` Luke Diamand
@ 2011-05-09 4:50 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2011-05-09 4:50 UTC (permalink / raw)
To: Luke Diamand; +Cc: git, Pete Wyckoff
Luke Diamand <luke@diamand.org> writes:
> . Slightly more paranoid checking of results from 'p4 change'
> . Remove superfluous "-G"
> . Don't modify the username if it is unchanged.
> . Add a comment in the change template to show what is
> going to be done.
>
> Signed-off-by: Luke Diamand <luke@diamand.org>
Thanks.
The patch text was different from the interdiff between the previous two
patches that got Ack from Pete, so I didn't realize this was your
incremental conversion until now. Will queue this one on 'pu' but I'd like
an Ack from Pete or other git-p4 folks before merging this down to 'next'.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-09 4:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07 10:19 [PATCH] git-p4: small improvements to user-preservation Luke Diamand
2011-05-07 10:19 ` Luke Diamand
2011-05-09 4:50 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.