[pkg-perl-tools] 01/01: alioth-repo: If origin already exists, check if it's the right one. Skip creation if so.

Axel Beckert abe at deuxchevaux.org
Tue Jul 21 21:32:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository pkg-perl-tools.

commit 6d2a5b3bfc8587baf6a8a2da346d0937dd67f7cc
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Tue Jul 21 23:32:41 2015 +0200

    alioth-repo: If origin already exists, check if it's the right one. Skip creation if so.
---
 debian/changelog    | 21 ++++-----------------
 scripts/alioth-repo | 17 +++++++++++------
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 21106cf..2d038b7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,20 +1,6 @@
 pkg-perl-tools (0.21) UNRELEASED; urgency=medium
 
-  TODO:
-  - "dpt push" with notes still needs to be tested.
-  - review 87ad5a7 (dpt-alioth-repo / remote "origin"):
-    in its current form it means that dpt-alioth-repo always bails out on
-    packages created with dh-make-perl which already sets the git remote
-    "origin" to git.debian.org. - ideas:
-    + revert commit. disadvantadge: leaves the confusing error when "git remote
-      add" fails which was the reason for this change. (Note that the error is
-      caught, only the message is confusing.)
-    + revert and add some message ("don't worry about an error ...")
-    + bail out only if a remote "origin" exists and does not point to git.d.o
-    + bail out only if a remote "origin" exists and is not the remote we
-      wanted to add.
-    + if a remote "origin" exists, rename it and continue
-    + something else :)
+  TODO: "dpt push" with notes still needs to be tested.
 
   [ Salvatore Bonaccorso ]
   * examples/b: Use buildpackage subcomand for gbp in case git directory
@@ -28,8 +14,9 @@ pkg-perl-tools (0.21) UNRELEASED; urgency=medium
   [ Axel Beckert ]
   * Also push git notes with "dpt push" for use with Niko Tyni's
     git-debcherry variant (see #784159)
-  * dpt-alioth-repo: Check if a remote named "origin" already exists
-    before creating the remote repository.
+  * dpt-alioth-repo: Check if a remote named "origin" already exists and
+    if it's already the expected remote repository before creating a
+    remote repository named "origin".
   * Use Gbp-Dch instead of Git-Dch in examples/mass-commit and
     dpt-upstream-repo.
   * Remove .mailmap stanza from debian/copyright. It's only needed in the
diff --git a/scripts/alioth-repo b/scripts/alioth-repo
index b0396cd..8d7045c 100755
--- a/scripts/alioth-repo
+++ b/scripts/alioth-repo
@@ -49,14 +49,19 @@ fi
 
 # Check if there is already a remote called "origin" before proceeding
 if git remote | egrep -q '^origin$'; then
-    echo 'A remote called "origin" already exists. Aborting.' 1>&2
-    echo 'You may want to rename it with "git remote rename origin origin-old".' 1>&2
-    exit 1;
+    if git remote -v | egrep "^origin[[:space:]].*git\.debian.org.*/git/pkg-perl/packages/$PKG\.git\b.*\(push\)$"; then
+        echo 'A remote called "origin" already exists and looks like the right one.' 1>&2
+        echo 'Skipping creation and addition of the remote repository.' 1>&2
+    else
+        echo "A remote called \"origin\" already exists and doesn't look right. Aborting." 1>&2
+        echo 'You may want to rename it with "git remote rename origin origin-old".' 1>&2
+        exit 1;
+    fi
+else
+    ssh git.debian.org /git/pkg-perl/setup-repository $PKG \"Debian packaging of $DIST CPAN distribution\"
+    git remote add origin ssh://git.debian.org/git/pkg-perl/packages/$PKG.git || [ $? = 128 ]
 fi
 
-ssh git.debian.org /git/pkg-perl/setup-repository $PKG \"Debian packaging of $DIST CPAN distribution\"
-
-git remote add origin ssh://git.debian.org/git/pkg-perl/packages/$PKG.git || [ $? = 128 ]
 git push --all origin --set-upstream
 git push --tags origin
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list