#3 Rebase to 1.0.2.1 and move to Python3
Merged 4 months ago by pstodulk. Opened 5 months ago by pstodulk.
rpms/ pstodulk/git-remote-hg move_to_py3  into  master

file modified
+1
@@ -2,3 +2,4 @@ 

  /git-remote-hg-0.3.tar.gz

  /git-remote-hg-0.4.tar.gz

  /git-remote-hg-1.0.0.tar.gz

+ /git-remote-hg-1.0.2.1.tar.gz

@@ -1,65 +0,0 @@ 

- From 05d230688462ada50ab275a4c8e674688426694f Mon Sep 17 00:00:00 2001

- From: Mark Nauwelaerts <mnauw@users.sourceforge.net>

- Date: Mon, 1 Jun 2020 16:22:01 +0200

- Subject: [PATCH] Apply url encoding for additional refname sanitizing

- 

- Fixes mnauw/git-remote-hg#33

- 

- @pstodulk note: Backported for v1.0.0

- ---

-  README.asciidoc |  8 +++++---

-  git-remote-hg   | 10 ++++++++--

-  2 files changed, 13 insertions(+), 5 deletions(-)

- 

- diff --git a/README.asciidoc b/README.asciidoc

- index d0cdbe2..5015e7e 100644

- --- a/README.asciidoc

- +++ b/README.asciidoc

- @@ -247,9 +247,11 @@ to fully complete the conversion (prior to subsequent pushing).

-  Some Mercurial names (of branches, bookmarks, tags) may not be a valid git

-  refname. See e.g. `man git-check-ref-format` for a rather involved set of rules.

-  Moreover, while a slash `/` is allowed, it is not supported to have both a `parent`

- -and `parent/child` branch (though only the latter is allowed). So, pending some

- -"nice" bidirectional encoding (not even e.g. URL encoding is safe actually), it is more

- -likely that only a few instances (out of a whole Mercurial repo) are

- +and `parent/child` branch (though only the latter is allowed). Even though

- +it is not quite (bidirectionally) safe, a (percentage) URL encoding

- +(with some additional twist) is performed to obtain sane git refnames, at least

- +so for most cases.  If some nasty cases still slip through, then likely only

- +a few instances (out of a whole Mercurial repo) are

-  problematic.  This could be handled by a single-branch clone and/or configuring

-  a suitable refspec.  However, it might be more convenient to simply filter out a

-  few unimportant pesky cases, which can be done by configuring a regural

- diff --git a/git-remote-hg b/git-remote-hg

- index 2c07917..cb8582d 100755

- --- a/git-remote-hg

- +++ b/git-remote-hg

- @@ -29,6 +29,9 @@ import urlparse

-  import hashlib

-  import time as ptime

-  

- +urlquote = urllib.quote

- +urlunquote = urllib.unquote

- +

-  #

-  # If you want to see Mercurial revisions as Git commit notes:

-  # git config core.notesRef refs/notes/hg

- @@ -86,10 +89,13 @@ def hgbin(n):

-      return node.bin(n)

-  

-  def hgref(ref):

- -    return ref.replace('___', ' ')

- +    return urlunquote(ref.replace('___', '%20').replace('%5F%5F%5F', '___'))

-  

-  def gitref(ref):

- -    return ref.replace(' ', '___')

- +    # standard url percentage encoding with a (legacy) twist:

- +    # ' ' -> '___'

- +    # '___' also percentage encoded

- +    return urlquote(ref).replace('___', '%5F%5F%5F').replace('%20', '___')

-  

-  def check_version(*check):

-      if not hg_version:

- -- 

- 2.26.2

- 

file modified
+18 -9
@@ -1,7 +1,7 @@ 

  %global debug_package %{nil}

  Name:           git-remote-hg

- Version:        1.0.0

- Release:        7%{?dist}

+ Version:        1.0.2.1

+ Release:        2%{?dist}

  BuildArch:      noarch

  Summary:        Mercurial wrapper for git

  License:        GPLv2+
@@ -11,13 +11,13 @@ 

  # 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

- Patch01:        0001-Apply-url-encoding-for-additional-refname-sanitizing.patch

  

  BuildRequires:  asciidoc >= 8.4.1

- BuildRequires:  python2-devel

- Requires:       python2

- Requires:       git >= 2.0.0

- Requires:       mercurial >= 3.5

+ BuildRequires:  python3-devel

+ Requires:       python3

+ Requires:       git-core >= 2.0.0

+ Requires:       mercurial >= 5.4

+ Requires:       mercurial-py3

  Obsoletes:      git-hg

  

  %description
@@ -27,8 +27,8 @@ 

  

  %prep

  %setup -q

- %patch01 -p1

- sed -i -e "1 s|^#!.*|#!%{__python2}|" git-remote-hg

+ #%patch01 -p1

+ sed -i -e "1 s|^#!.*|#!%{__python3}|" git-remote-hg

  sed -i -e 's|\tinstall|\tinstall -p|' Makefile

  

  %build
@@ -49,6 +49,15 @@ 

  %{_mandir}/man1/*

  

  %changelog

+ * Tue Dec 01 2020 Todd Zullinger <tmz@pobox.com> - 1.0.2.1-2

+ - require git-core rather than git to reduce dependencies

+ 

+ * Tue Dec 01 2020 Petr Stodulka <pstodulk@redhat.com> - 1.0.2.1-1

+ - Rebase to 1.0.2.1

+ - Transfer to Python3

+ - Requires Mercurial v5.4+ for Python3 (mercurial-py3)

+ - Resolves: rhbz#1738965, rhbz#1893525

+ 

  * Tue Dec 01 2020 Petr Stodulka <pstodulk@redhat.com> - 1.0.0-7

  - Apply url encoding for additional refname sanitizing

  - Resolves: #1893525

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (git-remote-hg-1.0.0.tar.gz) = 344349b8c64db5ad629176c664713773b4e8fe5ddf6bd13e7f3cac421f82eeb93fdd8aa59a2baab4b36b533cd6721adf8d31c69d4cc761e43c093c4d531c1a7d

+ SHA512 (git-remote-hg-1.0.2.1.tar.gz) = 722de4946e12fbeed40303682406455fcad347f718ac2f849982e6beaba263e434065ed44318aa9676431214ddd059ac917fe744c468f8388381fa2829183dcb

  • Rebase to v 1.0.2.1
  • Transfer to Python3
  • Requires Mercurial v5.4+ for Python3 (mercurial-py3)
  • Python2 support is dropped
  • reduce deps from git to git-core
  • Resolves: rhbz#1738965, rhbz#1893525

I am targetting mainly for mercurial builds with dropped Py2 (currently PR https://src.fedoraproject.org/rpms/mercurial/pull-request/13). I haven't done any testing yet.

I built #4 on top of this, to reduce the deps by requiring git-core rather than git. I noticed the git dep while testing a git fast-import bug and thought it would be good to replace with git-core to trim down the install footprint.

Hope the mercurial python3 testing goes well!

@tmz Thanks Todd! It seems right to reduce the deps. I plan to look at it & Mercurial this Saturday. If you are ok with that, I would like to include your changes into this PR.

That sounds good to me @pstodulk. Assuming the change is a good one, how it gets into the package is the least important part, to me.

In addition to testing the s/git/git-core change by cloning the nss repo, I took a look at the git subcommands shipped in git and then checked whether any were used in git-remote-hg. I didn't find any.

What I ran was rpm -ql git | grep /usr/libexec and then in the upstream git-remote-hg repo git grep -Ew 'add|contacts|credential|difftool|filter-branch|request-pull'.

(For git add I was only looking for invocations which passed in add --interactive. Eventually, that will make it to git-core, when the builtin add -i/-p support is made the default.)

Thanks Todd for sharing your investigation!

Currently I am stucked a little bit with git-remote-hg functionality as after the upgrade, the git pull command consumed 13+GB RAM and wanted still more so I had to kill it. After the downgrade (uninstall of the new rpms and installation of the old ones manually, as dnf downgrade is not working well in case of renamed rpms) I see the same problem on already cloned repositories. But I haven't realized this problem on clean system and freshly clonned repositories - but maybe it was there and I just missed that. I will continue tonight.

@pstodulk, I think you may be hitting RHBZ#1900335. If you want to confirm that, you can test the updates I've just submitted for F33/F34:

F33: https://bodhi.fedoraproject.org/updates/FEDORA-2020-5476485ad2
F34: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f68ba102e8

Alternately, you can install the git update from my tmz/git COPR.

1 new commit added

  • require git-core rather than git to reduce dependencies
5 months ago

rebased onto adb4460

4 months ago

rebased onto ee8ccf7

4 months ago

@tmz You were right. It was the problem :) I have rebased against latest changes I made recently in master. So far, the current build is working with new mercurial and git pretty well.

For easier testing, here are the builds of mercurial and git-remote-hg: https://copr.fedorainfracloud.org/coprs/opohorel/mercurial

2 new commits added

  • require git-core rather than git to reduce dependencies
  • Rebase to 1.0.2.1
4 months ago

So mercurial with dropped Py2 is out as I can see. So merging.

Pull-Request has been merged by pstodulk

4 months ago