improve handling of upstream pristine-tar branch
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 1 Feb 2008 18:56:41 +0000 (13:56 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 1 Feb 2008 18:56:41 +0000 (13:56 -0500)
debian/changelog
pristine-tar

index ad75ce1..a5f9845 100644 (file)
@@ -5,6 +5,9 @@ pristine-tar (0.6) UNRELEASED; urgency=low
     name. This way if there is a local upstream branch and a remote one, it
     will use the local one. If there's only a remote one, it'll use that.
     Closes: #463566
+  * Handle the case where this is no local pristine-tar branch. If there
+    is exactly one remote branch, use it for checkout. If more than one or
+    none, show a nice error message. (Cyril Brulebois)
 
  -- Joey Hess <joeyh@debian.org>  Fri, 01 Feb 2008 13:33:04 -0500
 
index 853f0f8..b7a1783 100755 (executable)
@@ -480,23 +480,18 @@ sub checkoutdelta {
 
        my $vcs=vcstype();
        if ($vcs eq "git") {
-               # Check a local pristine-tar branch exists
+               # Check that a local $branch exists
                my @reflines=map { chomp; $_ } `git show-ref \Q$branch\E`;
                if (! grep { "refs/heads/$branch" eq $_ } @reflines) {
-                       # a local pristine-tar branch is missing
-                       message "no local pristine-tar branch found";
                        if (scalar @reflines == 0) {
-                               error 'no pristine-tar branch at all, use "pristine-tar commit" first';
+                               error "no $branch branch found, use \"pristine-tar commit\" first";
                        }
                        elsif (scalar @reflines == 1) {
-                               my $proposed=$reflines[0];
-                               $proposed =~ s/^.*\s+//;
-                               message "Q: Do you want to create one from the $proposed branch? [Y/n]";
-                               # Prompt here.
-                               error "still no local pristine-tar branch";
+                               ($branch)=$reflines[0]=~/^[A-Za-z0-9]+\s(.*)/;
                        }
                        else {
-                               error 'Several remote pristine-tar branches exist, use "git-branch pristine-tar $remote/pristine-tar" to create a local pristine-tar branch';
+                               error "Several remote $branch branches exist. Run \"git branch --track $branch <remote>\" to create a local $branch branch\n".
+                                       join("\n", @reflines);
                        }
                }