git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Luke Diamand <luke@diamand.org>
Cc: Pete Wyckoff <pw@padd.com>, git@vger.kernel.org
Subject: Re: [PATCH v3] git-p4: add option to preserve user names
Date: Sat, 07 May 2011 15:22:48 -0700	[thread overview]
Message-ID: <7viptmup53.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110506235912.GA11842@arf.padd.com> (Pete Wyckoff's message of "Fri, 6 May 2011 19:59:12 -0400")

Pete Wyckoff <pw@padd.com> writes:

> luke@diamand.org wrote on Fri, 06 May 2011 06:25 +0100:
>> On 06/05/11 06:07, Junio C Hamano wrote:
>> >Luke Diamand<luke@diamand.org>  writes:
>> >
>> >>This is version 3 of my patch.
>> >
>> >The previous one from Apr 21st is already on "next" with Ack from Pete.
>> 
>> Ah, sorry.
>> 
>> Should I submit a patch against that then?
>
> Yes, your changes look good and fix bugs.
>
> To the diff from v2 to v3:
>
> Acked-by: Pete Wyckoff <pw@padd.com>

So the only thing lacking at this point is the commit log message?

I am not sure if the "actual user is luke" message you give when (and only
when) preserveUser is used is a good "reminder".  Isn't it that the user
needs reminder when the user should have used but forgot to use this
option, not the other way around like your patch does?

I suspect that the message would show an unexpected name only when the new
codepath is buggy or the P4 changes the code is interacting are formatted
in ways that the new codepath is not expecting (well, they amount to the
same thing after all, no?), and having such a message may prevent users
from submitting the changeset under an incorrect name, but at that point
what recourse do they have?

It looks to me that the message is not helping the users, even though it
may help as a debugging aid for git-p4 developers.

-- >8 --
Subject: git-p4 --preserve-user: finishing touches

The earlier round unnecessarily updated the user field that is already
correct.

Add a message with the P4 user name used in the submit template to
remind the user when this option is given.

Form the change spec string correctly, without relying on the way
Python happens to order the dictionary contents.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
---
 contrib/fast-import/git-p4 |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 36e3d87..6018507 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -688,12 +688,18 @@ class P4Submit(Command, P4UserMap):
         die("Could not get changelist number for last submit - cannot patch up user details")
 
     def modifyChangelistUser(self, changelist, newUser):
-        # fixup the user field of a changelist after it has been submitted.
+        # fixup the user field of a single changelist after it has been submitted.
         changes = p4CmdList("change -o %s" % changelist)
+        input = ''
         for c in changes:
             if c.has_key('User'):
+                if c['User'] == newUser:
+                    # nothing to do here
+                    return
                 c['User'] = newUser
-        input = marshal.dumps(changes[0])
+
+            input = input + marshal.dumps(c)
+
         result = p4CmdList("change -f -i", stdin=input)
         for r in result:
             if r.has_key('code'):
@@ -703,11 +709,10 @@ class P4Submit(Command, P4UserMap):
                 print("Updated user field for changelist %s to %s" % (changelist, newUser))
                 return
         die("Could not modify user field of changelist %s to %s" % (changelist, newUser))
-
     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 = ""

  reply	other threads:[~2011-05-07 22:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  6:43 [PATCH v3] git-p4: add option to preserve user names Luke Diamand
2011-05-05  6:43 ` Luke Diamand
2011-05-06  5:07 ` Junio C Hamano
2011-05-06  5:25   ` Luke Diamand
2011-05-06 23:59     ` Pete Wyckoff
2011-05-07 22:22       ` Junio C Hamano [this message]
2011-05-08 10:58         ` Luke Diamand
2011-05-08 17:32           ` Junio C Hamano
2011-05-08 20:35             ` Luke Diamand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7viptmup53.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=luke@diamand.org \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).