From: Luke Diamand <luke@diamand.org>
To: Pete Wyckoff <pw@padd.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/4] git-p4: commit time should be most recent p4 change time
Date: Sun, 31 Jul 2011 11:14:55 +0100 [thread overview]
Message-ID: <4E352B1F.4070402@diamand.org> (raw)
In-Reply-To: <20110731003953.GE4867@arf.padd.com>
On 31/07/11 01:39, Pete Wyckoff wrote:
> When importing a repo, the time on the initial commit had been
> just "now". But this causes problems when trying to share among
> git-p4 repos that were created identically, although at different
> times. Instead, use the time in the top-most p4 change as the
> time for the git import commit.
Ack.
>
> Signed-off-by: Pete Wyckoff<pw@padd.com>
> ---
> contrib/fast-import/git-p4 | 15 ++++++++++++++-
> t/t9800-git-p4.sh | 14 ++++++++++++++
> 2 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 98d2aee..6b9de9e 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -1649,7 +1649,8 @@ class P4Sync(Command, P4UserMap):
> def importHeadRevision(self, revision):
> print "Doing initial import of %s from revision %s into %s" % (' '.join(self.depotPaths), revision, self.branch)
>
> - details = { "user" : "git perforce import user", "time" : int(time.time()) }
> + details = {}
> + details["user"] = "git perforce import user"
> details["desc"] = ("Initial import of %s from the state at revision %s\n"
> % (' '.join(self.depotPaths), revision))
> details["change"] = revision
> @@ -1689,6 +1690,18 @@ class P4Sync(Command, P4UserMap):
> fileCnt = fileCnt + 1
>
> details["change"] = newestRevision
> +
> + # Use time from top-most change so that all git-p4 clones of
> + # the same p4 repo have the same commit SHA1s.
> + res = p4CmdList("describe -s %d" % newestRevision)
> + newestTime = None
> + for r in res:
> + if r.has_key('time'):
> + newestTime = int(r['time'])
> + if newestTime is None:
> + die("\"describe -s\" on newest change %d did not give a time")
> + details["time"] = newestTime
> +
> self.updateOptionDict(details)
> try:
> self.commit(details, self.extractFilesFromCommit(details), self.branch, self.depotPaths)
> diff --git a/t/t9800-git-p4.sh b/t/t9800-git-p4.sh
> index 24a8b79..1b5f4b2 100755
> --- a/t/t9800-git-p4.sh
> +++ b/t/t9800-git-p4.sh
> @@ -265,6 +265,20 @@ test_expect_success 'not preserving user with mixed authorship' '
> p4_check_commit_author usernamefile3 alice
> '
>
> +# Sleep a bit so that the top-most p4 change did not happen "now". Then
> +# import the repo and make sure that the initial import has the same time
> +# as the top-most change.
> +test_expect_success 'initial import time from top change time' '
> + p4change=$(p4 -G changes -m 1 //depot/... | marshal_dump change)&&
> + p4time=$(p4 -G changes -m 1 //depot/... | marshal_dump time)&&
> + sleep 3&&
> + "$GITP4" clone --dest="$git" //depot&&
> + test_when_finished cleanup_git&&
> + cd "$git"&&
> + gittime=$(git show -s --raw --pretty=format:%at HEAD)&&
> + echo $p4time $gittime&&
> + test $p4time = $gittime
> +'
>
> test_expect_success 'shutdown' '
> pid=`pgrep -f p4d`&&
next prev parent reply other threads:[~2011-07-31 10:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-31 0:35 [PATCH 0/4] git-p4 test cleanup, commit time change Pete Wyckoff
2011-07-31 0:38 ` [PATCH 1/4] git-p4: use test_when_finished in tests Pete Wyckoff
2011-07-31 9:59 ` Luke Diamand
2011-07-31 0:39 ` [PATCH 2/4] git-p4: make tests work on p4d eval server Pete Wyckoff
2011-07-31 0:39 ` [PATCH 3/4] git-p4: one test missing config git-p4.skipSubmitEditCheck Pete Wyckoff
2011-07-31 10:01 ` Luke Diamand
2011-07-31 0:39 ` [PATCH 4/4] git-p4: commit time should be most recent p4 change time Pete Wyckoff
2011-07-31 10:14 ` Luke Diamand [this message]
2011-07-31 9:49 ` [PATCH 0/4] git-p4 test cleanup, commit time change Luke Diamand
2011-07-31 13:42 ` Pete Wyckoff
2011-07-31 16:01 ` Luke Diamand
2011-07-31 13:44 ` [PATCHv2 " Pete Wyckoff
2011-07-31 13:44 ` [PATCHv2 1/4] git-p4: use test_when_finished in tests Pete Wyckoff
2011-07-31 13:45 ` [PATCHv2 2/4] git-p4: add missing && in test Pete Wyckoff
2011-07-31 13:55 ` Luke Diamand
2011-07-31 13:45 ` [PATCHv2 3/4] git-p4: one test missing config git-p4.skipSubmitEditCheck Pete Wyckoff
2011-07-31 13:45 ` [PATCHv2 4/4] git-p4: commit time should be most recent p4 change time Pete Wyckoff
-- strict thread matches above, loose matches on Subject: below --
2011-08-07 13:31 [PATCH 0/4] git-p4 test cleanup, commit time change Pete Wyckoff
2011-08-07 13:37 ` [PATCH 4/4] git-p4: commit time should be most recent p4 change time 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=4E352B1F.4070402@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 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.