git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
To: git@vger.kernel.org
Cc: Pete Wyckoff <pw@padd.com>, Luke Diamand <luke@diamand.org>
Subject: [PATCH/RFC v2] git-p4: add option to preserve user names
Date: Thu, 21 Apr 2011 20:50:22 +0100	[thread overview]
Message-ID: <1303415423-12445-1-git-send-email-luke@diamand.org> (raw)

Patches from git passed into p4 end up with the committer
being identified as the person who ran git-p4.

This patch adds an option --preserve-user. When enabled, git-p4
will modify the changelist after it has been submitted ("p4 change -f")
and set the username to the one matching the git author.

If the person running git-p4 does not have sufficient permissions,
git-p4 will refuse to run (detected using "p4 protects").
It's possible that complicated permissions setups might confuse
git-p4 - it just looks to see if the user has admin or super on
the repo. In theory they might have permissions in some parts
and not in others.

If there are commits with authors who do not have p4 accounts, then
git-p4 will refuse to run unless git-p4.allowMissingP4Users is true,
in which case it falls back to the standard behaviour for those
commits.

The code has to get the p4 changelist number. The way it
does this is by simply doing 'p4 changes -c <client>', which
means if someone else is using the same clientspec at the
same time, there is a potential race hazard. The alternative
is to rewrite the submit logic to submit a properly marshalled
template, which felt a bit too intrusive.

I've hoisted the p4 user name cache to a separate class, since it
gets used in a couple of different places now.

I've added an option git-p4.skipSubmitModTimeCheck so that I can
write a test case without having to jump through hoops with the
editor.

Luke Diamand (1):
  git-p4: add option to preserve user names

 contrib/fast-import/git-p4     |  179 +++++++++++++++++++++++++++++++---------
 contrib/fast-import/git-p4.txt |   29 +++++++
 t/t9800-git-p4.sh              |   84 +++++++++++++++++++
 3 files changed, 254 insertions(+), 38 deletions(-)

             reply	other threads:[~2011-04-21 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 19:50 Luke Diamand [this message]
2011-04-21 19:50 ` [PATCH] git-p4: add option to preserve user names Luke Diamand
2011-04-23 11:54   ` Pete Wyckoff

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=1303415423-12445-1-git-send-email-luke@diamand.org \
    --to=luke@diamand.org \
    --cc=git@vger.kernel.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).