[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.4.1-28-g4c46b9e
Stephane Glondu
steph at glondu.net
Thu Jun 18 17:25:50 UTC 2009
The following commit has been merged in the master branch:
commit 636034337d07e6530dd9a31295a196fc127bf98b
Author: Stephane Glondu <steph at glondu.net>
Date: Thu Jun 18 19:07:09 2009 +0200
Add dom-safe-pull
diff --git a/debian/changelog b/debian/changelog
index 5a887e2..6cd07f7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,14 +1,14 @@
dh-ocaml (0.4.2) UNRELEASED; urgency=low
[ Stephane Glondu ]
- * Add ocaml-pkg-update-uploaders (Closes: #516764)
* Use "<<" for Replaces, not "<=" (Closes: #528241)
+ * Add ocaml-pkg-update-uploaders (Closes: #516764)
+ * Add dom-safe-pull
[ Mehdi Dogguy ]
* Add variables OCAML_RUNTIME and OCAML_RUNTIME_NOX in ocamlvars.mk: which
are, respectively, ocaml-base-nox-$(OCAML_ABI) and ocaml-base-$(OCAML_ABI)
on non-native archs.
- * Move ocaml-pkg-update-uploaders to /usr/share/ocaml/pkg-update-uploaders
* Install script tools dom-{new-git-repo,git-checkout,mrconfig} in
/usr/bin (Closes: #516777)
* Install dom-{apply,save}-patches in /usr/bin/ and update policy to
@@ -18,7 +18,7 @@ dh-ocaml (0.4.2) UNRELEASED; urgency=low
* Add a section on setting the archive section of ocaml programs.
* Set Section to ocaml
- -- Mehdi Dogguy <dogguy at pps.jussieu.fr> Wed, 20 May 2009 14:00:28 +0200
+ -- Stephane Glondu <steph at glondu.net> Thu, 18 Jun 2009 18:30:10 +0200
dh-ocaml (0.4.1) unstable; urgency=low
diff --git a/tools/dom-mrconfig b/tools/dom-mrconfig
index d788fe5..46f1f4d 100755
--- a/tools/dom-mrconfig
+++ b/tools/dom-mrconfig
@@ -60,7 +60,7 @@ lib=
}
update_check () {
if [ -d .git ]; then
- git pull
+ dom-safe-pull
else
svn update
if [ -f \"trunk/README\" ] && [[ \"\`cat trunk/README\`\" =~ \"This package has moved\" ]]; then
diff --git a/tools/dom-safe-pull b/tools/dom-safe-pull
new file mode 100755
index 0000000..2f9b6cc
--- /dev/null
+++ b/tools/dom-safe-pull
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+#
+# Description: safely pull all branches of a Git repository
+#
+# Copyright © 2009 Stéphane Glondu <steph at glondu.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+#
+
+sub update_remotes () {
+ for (`git remote`) {
+ chomp;
+ print "Feching $_...\n";
+ system "git fetch $_";
+ }
+}
+
+sub get_remote ($) {
+ my $branch = shift;
+ my $remote = `git config --get "branch.${branch}.remote"`;
+ chomp $remote;
+ if ($remote) {
+ my $merge = `git config --get "branch.${branch}.merge"`;
+ chomp $merge;
+ $merge =~ s@^refs/heads/@@;
+ return "$remote/$merge";
+ } else {
+ return undef;
+ }
+}
+
+sub update_if_fastforward ($) {
+ my $branch = shift;
+ system("git checkout $branch") == 0 or die();
+ if (my $remote = get_remote($branch)) {
+ my $theirs = 0, $ours = 0;
+ for (`git rev-list --left-right "${branch}...${remote}" --`) {
+ $theirs++ if /^>/;
+ $ours++ if /^</;
+ }
+ if ($ours == 0) {
+ system("git merge ${remote}") == 0 or die();
+ } elsif ($theirs > 0) {
+ die "E: ${branch} has diverged from ${remote}, fix manually!\n";
+ } else {
+ print "I: ${branch} is ahead of ${remote} by ${ours} commits\n";
+ }
+ }
+}
+
+my $current = `git log -1 --pretty="%H"`;
+chomp $current;
+for (`git branch`) {
+ chomp;
+ if (s/^\*\s+//) {
+ # we will update the current branch at the end
+ $current = $_ unless /no branch/;
+ } else {
+ s/^\s+//;
+ update_if_fastforward($_);
+ }
+}
+update_if_fastforward($current);
--
dh-ocaml packaging
More information about the Pkg-ocaml-maint-commits
mailing list