On 16/10/13 02:22, Jonathan McCrohan wrote:
> I just noticed I inadvertently sent a version in which I had disabled
> the testsuite for faster debuilds.

Updated version attached; cleaned up one or two rough edges in the
previous patch.

Thanks,
Jon
From 75cea44a35fb823bd2575e14ecf3b232a8ccf289 Mon Sep 17 00:00:00 2001
From: Jonathan McCrohan <jmccro...@gmail.com>
Date: Sat, 19 Oct 2013 00:55:09 +0100
Subject: [PATCHv3] Add git-remote-hg support though git-hg package

Signed-off-by: Jonathan McCrohan <jmccro...@gmail.com>
---
 debian/changelog            | 14 ++++++++++++++
 debian/control              | 23 +++++++++++++++++++++--
 debian/git-doc.docs         |  1 +
 debian/git-hg.README.Debian | 27 +++++++++++++++++++++++++++
 debian/git-hg.postinst      |  8 ++++++++
 debian/git-hg.prerm         |  6 ++++++
 debian/git-remote-hg.txt    | 36 ++++++++++++++++++++++++++++++++++++
 debian/rules                | 27 +++++++++++++++++++++++++++
 8 files changed, 140 insertions(+), 2 deletions(-)
 create mode 100644 debian/git-hg.README.Debian
 create mode 100755 debian/git-hg.postinst
 create mode 100755 debian/git-hg.prerm
 create mode 100644 debian/git-remote-hg.txt

diff --git a/debian/changelog b/debian/changelog
index f78b6ec..c26f286 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+git (1:1.8.4-2) UNRELEASED; urgency=low
+
+  * add a git-hg package with hg remote helper (closes: #703864).
+    * debian/control: new package git-hg; Priority: extra; Depends: mercurial;
+      package git now Suggests and git-all Recommends: git-hg
+  * debian/git-remote-hg.txt: new; explain usage.
+  * debian/rules: process debian/git-remote-hg.txt with git's documentation
+    toolchain and install to /usr/share/man/man1/; munge
+    contrib/remote-helpers/git-remote-hg shebang line and install to
+    /usr/lib/git-core
+  * debian/git-doc.docs install git-remote-hg.html
+
+ -- Jonathan McCrohan <jmccro...@gmail.com>  Sat, 19 Oct 2013 00:47:35 +0100
+
 git (1:1.8.4-1.1) experimental; urgency=low
 
   * debian/control: Build-Depends tcl instead of tcl8.5.
diff --git a/debian/control b/debian/control
index 75c4359..36d10e6 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Depends: ${shlibs:Depends}, perl-modules, liberror-perl,
 Recommends: patch, less, rsync, ssh-client
 Suggests: gettext-base, git-daemon-run | git-daemon-sysvinit,
  git-doc, git-el, git-email, git-gui, gitk, gitweb,
- git-arch, git-bzr, git-cvs, git-svn
+ git-arch, git-bzr, git-cvs, git-hg, git-svn
 Replaces: gitweb (<< 1:1.7.4~rc1),
  git-core (<< 1:1.7.0.4-1.)
 Breaks: bash-completion (<< 1:1.90-1), gitweb (<< 1:1.7.4~rc1),
@@ -172,6 +172,25 @@ Description: fast, scalable, distributed revision control 
system (cvs interopera
  incorrect results. For reliable, one-shot imports, cvs2git from the
  cvs2svn package or parsecvs may be a better fit.
 
+Package: git-hg
+Architecture: all
+Multi-Arch: foreign
+Depends: git (>> ${source:Upstream-Version}), git (<< 
${source:Upstream-Version}-.), python, mercurial
+Suggests: git-doc, mercurial
+Description: fast, scalable, distributed revision control system (hg 
interoperability)
+ Git is a popular version control system designed to handle very large         
+ projects with speed and efficiency; it is used for many high profile          
+ open source projects, most notably the Linux kernel.                          
+ .                                                                             
+ Git falls in the category of distributed source code management tools.        
+ Every Git working directory is a full-fledged repository with full            
+ revision tracking capabilities, not dependent on network access or a          
+ central server.                                                               
+ .                                                                             
+ This package provides the hg remote helper, which allows Git to              
+ read from and write to Mercurial repositories as though they were remote      
   
+ Git repositories. 
+
 Package: git-svn
 Architecture: all
 Multi-Arch: foreign
@@ -358,7 +377,7 @@ Architecture: all
 Multi-Arch: foreign
 Depends: git (>> ${source:Upstream-Version}), git (<< 
${source:Upstream-Version}-.),
  git-doc, git-el, git-arch, git-cvs, git-svn, git-email, git-gui, gitk, gitweb
-Recommends: git-bzr, git-daemon-run | git-daemon-sysvinit
+Recommends: git-bzr, git-hg, git-daemon-run | git-daemon-sysvinit
 Description: fast, scalable, distributed revision control system (all 
subpackages)
  Git is popular version control system designed to handle very large
  projects with speed and efficiency; it is used for many high profile
diff --git a/debian/git-doc.docs b/debian/git-doc.docs
index 4caccf4..6ef3d46 100644
--- a/debian/git-doc.docs
+++ b/debian/git-doc.docs
@@ -1,3 +1,4 @@
 tmp/html/*
 debian/git-remote-bzr.html
+debian/git-remote-hg.html
 Documentation/technical
diff --git a/debian/git-hg.README.Debian b/debian/git-hg.README.Debian
new file mode 100644
index 0000000..e51306e
--- /dev/null
+++ b/debian/git-hg.README.Debian
@@ -0,0 +1,27 @@
+git-remote-hg for Debian
+-------------------------
+
+See the git-remote-hg(1) man page for documentation.
+
+Multiple packages include hg remote helpers that allow Git to access
+a Bazaar repository as though it were a remote Git repository.
+
+The default handler of hg:// and hg:: URLs is set using the
+alternatives system:
+
+       # update-alternatives --config git-remote-hg
+
+Users without root access can override that default for their own
+usage by installing a symbolic link git-remote-hg ->
+/usr/lib/git-core/git-remote-hg--git to their $PATH.
+
+To request Git's hg remote helper for an individual request, use a
+"hg--git::" in the URL instead of "hg::".  For example:
+
+       git clone hg--git::$HOME/myrepo
+
+or
+
+       git clone hg--git::http://host.xz/path/to/hg/tip
+
+ -- Jonathan McCrohan <jmccro...@gmail.com>  Fri, 18 Oct 2013 23:48:34 +0100
diff --git a/debian/git-hg.postinst b/debian/git-hg.postinst
new file mode 100755
index 0000000..e85e2ef
--- /dev/null
+++ b/debian/git-hg.postinst
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+cmd=git-remote-hg
+update-alternatives --install \
+  /usr/bin/$cmd $cmd /usr/lib/git-core/$cmd--git 50 \
+  --slave /usr/share/man/man1/$cmd.1.gz $cmd.1.gz \
+          /usr/share/man/man1/$cmd--git.1.gz
diff --git a/debian/git-hg.prerm b/debian/git-hg.prerm
new file mode 100755
index 0000000..9d3358d
--- /dev/null
+++ b/debian/git-hg.prerm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+test "$1" != upgrade || exit 0
+
+cmd=git-remote-hg
+update-alternatives --remove $cmd /usr/lib/git-core/$cmd--git
diff --git a/debian/git-remote-hg.txt b/debian/git-remote-hg.txt
new file mode 100644
index 0000000..3b2175e
--- /dev/null
+++ b/debian/git-remote-hg.txt
@@ -0,0 +1,36 @@
+git-remote-hg(1)
+=================
+
+NAME
+----
+git-remote-hg - Fetch from or push to a Mercurial repository
+
+SYNOPSIS
+--------
+'git clone' hg::/path/to/hg/repo/or/url
+
+DESCRIPTION
+-----------
+
+This remote helper allows commands like 'git fetch' and 'git push'
+to access a repository that was created using the *hg*(1) tool.
+
+Any URL that Mercurial supports can be used by preceding it with
+"hg::".  For example:
+
+- hg::ssh://host.xz/path/to/hg/tip - Bi-directional Mercurial over SSH
+- hg::http://host.xz/path/to/hg/tip - Uni-directional Mercurial over HTTP
+- hg::https://host.xz/path/to/hg/tip - Uni-directional Mercurial over HTTPS
+- hg::/path/to/hg/tip - local filesystem
+
+DEPENDENCIES
+------------
+mercurial (the Mercurial Python library)
+
+SEE ALSO
+--------
+linkgit:git-fetch[1], *hg*(1), linkgit:gitremote-helpers[1]
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/debian/rules b/debian/rules
index 4cdd764..9f7a2b2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,6 +37,7 @@ PKG_INDEP += git-doc
 PKG_INDEP += git-arch
 PKG_INDEP += git-bzr
 PKG_INDEP += git-cvs
+PKG_INDEP += git-hg
 PKG_INDEP += git-svn
 PKG_INDEP += git-daemon-run
 PKG_INDEP += git-daemon-sysvinit
@@ -87,12 +88,29 @@ build-indep-stamp: patch-stamp build-arch-stamp
            $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-bzr.sh || \
          PATH=$(CURDIR)/debian:$(PATH) GIT_TEST_OPTS=--verbose \
            $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-bzr.sh
+       $(MAKE) -CDocumentation $(DOC_OPTS) \
+         MAN_TXT=../debian/git-remote-hg.txt \
+         ../debian/git-remote-hg.1 \
+         ../debian/git-remote-hg.html
+       sed -e 's,/usr/bin/env python,/usr/bin/python,' \
+         contrib/remote-helpers/git-remote-hg >debian/git-remote-hg
+       sed -e 's/test_have_prereq PYTHON/true/' \
+         contrib/remote-helpers/test-hg.sh >debian/test-hg.sh
+       chmod +x debian/git-remote-hg debian/test-hg.sh
+       test -z '$(TEST)' || \
+         PATH=$(CURDIR)/debian:$(PATH) \
+           $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-hg.sh || \
+         PATH=$(CURDIR)/debian:$(PATH) GIT_TEST_OPTS=--verbose \
+           $(MAKE) -C t $(OPTS) $(CURDIR)/debian/test-hg.sh
        touch build-indep-stamp
 
 clean: deb-checkdir
        rm -f debian/git-remote-bzr debian/test-bzr.sh
        rm -f debian/git-remote-bzr.xml debian/git-remote-bzr.html
        rm -f Documentation/git-remote-bzr.1
+       rm -f debian/git-remote-hg debian/test-hg.sh
+       rm -f debian/git-remote-hg.xml debian/git-remote-hg.html
+       rm -f Documentation/git-remote-hg.1
        $(MAKE) clean $(OPTS)
        ! test -e patch-stamp || \
          for i in `ls -1r debian/diff/*.diff debian/diff/*.patch \
@@ -309,6 +327,15 @@ install-indep: build-arch-stamp build-indep-stamp
        gzip -9 '$(GIT)'-gui/usr/share/man/man1/*.1
        install -d -m0755 '$(GIT)'-gui/usr/share/git-gui
        cp -a '$(TMP)'/usr/share/git-gui/lib '$(GIT)'-gui/usr/share/git-gui/
+       # git-hg
+       rm -rf '$(GIT)'-hg
+       install -d -m0755 '$(GIT)'-hg/usr/lib/git-core
+       install -m0755 debian/git-remote-hg \
+         '$(GIT)'-hg/usr/lib/git-core/git-remote-hg--git
+       install -d -m0755 '$(GIT)'-hg/usr/share/man/man1
+       install -m0644 Documentation/git-remote-hg.1 \
+         '$(GIT)'-hg/usr/share/man/man1/git-remote-hg--git.1
+       gzip -9 '$(GIT)'-hg/usr/share/man/man1/*.1
        # gitk
        rm -rf '$(GIT)'k
        install -d -m0755 '$(GIT)'k/usr/bin
-- 
1.8.4

Reply via email to