From e371ba08e55c3eda2155623af92b974200699433 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jan 13 2015 02:19:10 +0000 Subject: backport an upstream PR to make it work with Mercurial 3.2 --- diff --git a/git-remote-hg-0.2-fix_mercurial_32.patch b/git-remote-hg-0.2-fix_mercurial_32.patch new file mode 100644 index 0000000..bb2db73 --- /dev/null +++ b/git-remote-hg-0.2-fix_mercurial_32.patch @@ -0,0 +1,51 @@ +From e716a9e1a9e460a45663694ba4e9e8894a8452b2 Mon Sep 17 00:00:00 2001 +From: Max Horn +Date: Sun, 9 Nov 2014 16:18:24 +0100 +Subject: [PATCH] Fix compatibility with Mercurial 3.2 + +--- + git-remote-hg | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/git-remote-hg b/git-remote-hg +index c10b37b..0d903e3 100755 +--- a/git-remote-hg ++++ b/git-remote-hg +@@ -430,7 +430,12 @@ def get_repo(url, alias): + peer = hg.peer(repo.ui, {}, url) + except: + die('Repository error') +- repo.pull(peer, heads=None, force=True) ++ ++ if check_version(3, 2): ++ from mercurial import exchange ++ exchange.pull(repo, peer, heads=None, force=True) ++ else: ++ repo.pull(peer, heads=None, force=True) + + updatebookmarks(repo, peer) + +@@ -803,7 +808,11 @@ def parse_commit(parser): + def getfilectx(repo, memctx, f): + of = files[f] + if 'deleted' in of: +- raise IOError ++ # the file is not available anymore - was deleted ++ if check_version(3, 2): ++ return None ++ else: ++ raise IOError + if 'ctx' in of: + return of['ctx'] + is_exec = of['mode'] == 'x' +@@ -1036,7 +1045,9 @@ def push_unsafe(repo, remote, parsed_refs, p_revs): + if not checkheads(repo, remote, p_revs): + return None + +- if check_version(3, 0): ++ if check_version(3, 2): ++ cg = changegroup.getchangegroup(repo, 'push', heads=list(p_revs), common=common) ++ elif check_version(3, 0): + cg = changegroup.getbundle(repo, 'push', heads=list(p_revs), common=common) + else: + cg = repo.getbundle('push', heads=list(p_revs), common=common) diff --git a/git-remote-hg.spec b/git-remote-hg.spec index 90e72dc..cdc37e4 100644 --- a/git-remote-hg.spec +++ b/git-remote-hg.spec @@ -1,13 +1,18 @@ %global debug_package %{nil} Name: git-remote-hg Version: 0.2 -Release: 4%{?dist} +Release: 5%{?dist} BuildArch: noarch Summary: Mercurial wrapper for git License: GPLv2+ Group: Development/Tools URL: https://github.com/felipec/git-remote-hg Source0: https://github.com/felipec/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# https://github.com/fingolfin/git-remote-hg/commit/e716a9e1a9e460a45663694ba4e9e8894a8452b2.patch +# https://github.com/felipec/git-remote-hg/pull/28 +# Makes it work with Mercurial 3.2 +# The second commit (to the tests) isn't needed against 0.2 +Patch0: git-remote-hg-0.2-fix_mercurial_32.patch BuildRequires: asciidoc >= 8.4.1 BuildRequires: hg-git @@ -26,6 +31,7 @@ repositories as if they were Git ones. %setup -q sed -i -e "1 s|^#!.*|#!%{__python2}|" git-remote-hg sed -i -e 's|\tinstall|\tinstall -p|' Makefile +%patch0 -p1 -b .merc32 %build make doc @@ -45,6 +51,9 @@ make install-doc %{_mandir}/man1/* %changelog +* Mon Jan 12 2015 Adam Williamson - 0.2-5 +- backport an upstream PR to make it work with Mercurial 3.2 + * Mon Dec 8 2014 Petr Stodulka - 0.2-4 - added obsoletes of git-hg