git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
Cc: marcus.holl@sap.com, Luke Diamand <luke@diamand.org>
Subject: [PATCHv1 2/3] git-p4: do not terminate creating tag for unknown commit
Date: Thu, 27 Aug 2015 08:18:57 +0100	[thread overview]
Message-ID: <1440659938-12952-3-git-send-email-luke@diamand.org> (raw)
In-Reply-To: <1440659938-12952-1-git-send-email-luke@diamand.org>

If p4 reports a tag for a commit that git-p4 does not know
about (e.g. because it references a P4 changelist that was
imported prior to the point at which the repo was cloned into
git), make sure that the error is correctly caught and handled.
rather than just crashing.

Signed-off-by: Luke Diamand <luke@diamand.org>
---
 git-p4.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index 073f87b..a62611a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2494,9 +2494,9 @@ class P4Sync(Command, P4UserMap):
                 # find the corresponding git commit; take the oldest commit
                 changelist = int(change['change'])
                 gitCommit = read_pipe(["git", "rev-list", "--max-count=1",
-                     "--reverse", ":/\[git-p4:.*change = %d\]" % changelist])
+                     "--reverse", ":/\[git-p4:.*change = %d\]" % changelist], ignore_error=True)
                 if len(gitCommit) == 0:
-                    print "could not find git commit for changelist %d" % changelist
+                    print "importing label %s: could not find git commit for changelist %d" % (name, changelist)
                 else:
                     gitCommit = gitCommit.strip()
                     commitFound = True
-- 
2.5.0.rc0

  parent reply	other threads:[~2015-08-27  7:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27  7:18 [PATCHv1 0/3] git-p4: fixing import with labels when commit is not transferred Luke Diamand
2015-08-27  7:18 ` [PATCHv1 1/3] git-p4: failing test for ignoring invalid p4 labels Luke Diamand
2015-08-27 12:53   ` Eric Sunshine
2015-08-27  7:18 ` Luke Diamand [this message]
2015-08-27  7:18 ` [PATCHv1 3/3] git-p4: fix P4 label import for unprocessed commits Luke Diamand
2015-09-14  6:45 ` [PATCHv1 0/3] git-p4: fixing import with labels when commit is not transferred Holl, Marcus

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=1440659938-12952-3-git-send-email-luke@diamand.org \
    --to=luke@diamand.org \
    --cc=git@vger.kernel.org \
    --cc=marcus.holl@sap.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).