Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mercurial-extension-hg-git for openSUSE:Factory checked in at 2023-11-09 21:36:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mercurial-extension-hg-git (Old) and /work/SRC/openSUSE:Factory/.mercurial-extension-hg-git.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mercurial-extension-hg-git" Thu Nov 9 21:36:11 2023 rev:12 rq:1124540 version:1.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/mercurial-extension-hg-git/mercurial-extension-hg-git.changes 2023-10-08 12:24:19.611121401 +0200 +++ /work/SRC/openSUSE:Factory/.mercurial-extension-hg-git.new.17445/mercurial-extension-hg-git.changes 2023-11-09 21:36:28.555273269 +0100 @@ -1,0 +2,14 @@ +Thu Nov 9 12:17:24 UTC 2023 - Andrei Dziahel <devel...@develop7.info> + +- hg-git 1.0.3 + + This is a minor release, focusing on bugs and compatibility. + + * Fix tests with Mercurial 6.5 + * Handle failures to save refs, such as when they use characters + forbidden by the file system; this is most easily noticed on Windows + and macOS. (#397) + * Fix pulling annotated tags with `-r`/`--rev`. +- drop fix_mercurial_6.5_compatibility.patch + +------------------------------------------------------------------- Old: ---- fix_mercurial_6.5_compatibility.patch hg-git-1.0.2.tar.gz New: ---- hg-git-1.0.3.tar.gz BETA DEBUG BEGIN: Old: * Fix pulling annotated tags with `-r`/`--rev`. - drop fix_mercurial_6.5_compatibility.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mercurial-extension-hg-git.spec ++++++ --- /var/tmp/diff_new_pack.gMz3kF/_old 2023-11-09 21:36:29.195296899 +0100 +++ /var/tmp/diff_new_pack.gMz3kF/_new 2023-11-09 21:36:29.195296899 +0100 @@ -24,7 +24,7 @@ %define pythons python3 Name: mercurial-extension-hg-git -Version: 1.0.2 +Version: 1.0.3 Release: 0 Summary: Hg-Git Mercurial plugin License: GPL-2.0-only @@ -32,8 +32,6 @@ URL: http://foss.heptapod.net/mercurial/hg-git Source0: https://files.pythonhosted.org/packages/source/h/hg-git/hg-git-%{version}.tar.gz Source90: tests.blacklist -# Unreleased upstream patch -Patch0: fix_mercurial_6.5_compatibility.patch BuildRequires: fdupes BuildRequires: git BuildRequires: mercurial @@ -64,7 +62,6 @@ %prep %setup -q -n hg-git-%{version} -%patch0 -p1 %build %pyproject_wheel ++++++ hg-git-1.0.2.tar.gz -> hg-git-1.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/.gitlab-ci.yml new/hg-git-1.0.3/.gitlab-ci.yml --- old/hg-git-1.0.2/.gitlab-ci.yml 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/.gitlab-ci.yml 2023-11-07 16:55:14.000000000 +0100 @@ -7,8 +7,6 @@ .base: image: registry.heptapod.net:443/mercurial/hg-git/ci/$CI_COMMIT_HG_BRANCH:hg-$HG-py$PYTHON timeout: 20m - tags: - - clever services: - name: registry.heptapod.net:443/mercurial/hg-git/git-server alias: git-server @@ -40,9 +38,9 @@ - &latest-versions PYTHON: - "3.6" - - "3.11" + - "3.12" HG: - - "6.4" + - "6.5" # This is the authoritative list of versions of Mercurial that this # extension is supported and tested with; it should be kept in sync @@ -74,6 +72,7 @@ - "6.1" - "6.2" - "6.3" + - "6.4" # Test that it is possible to use and run hg-git on versions of Alpine # that include Dulwich, and with the oldest Dulwich supported. @@ -81,8 +80,6 @@ stage: compat image: name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:$ALPINE - tags: - - clever variables: CI_CLEVER_CLOUD_FLAVOR: XS timeout: 20m @@ -95,7 +92,7 @@ apk add py3-dulwich else apk add build-base python3-dev - pip3 install dulwich==$DULWICH + pip3 install "urllib3<=2.0" dulwich==$DULWICH fi - pip3 install coverage - adduser -D test @@ -137,26 +134,14 @@ matrix: - &development-versions PYTHON: - - "3.11" + - "3.12" HG: - "stable" - "default" -# Test Alpine edge, which usually includes the very latest version of -# Git & Dulwich -Dependencies: - extends: Alpine - stage: compat - image: - name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:edge - rules: *upcoming-rules - parallel: - Coverage: stage: .post image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:alpine - tags: - - clever variables: CI_CLEVER_CLOUD_FLAVOR: XS allow_failure: true @@ -273,8 +258,6 @@ Wheels: image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python timeout: 15m - tags: - - clever variables: CI_CLEVER_CLOUD_FLAVOR: XS stage: archives diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/.hgsigs new/hg-git-1.0.3/.hgsigs --- old/hg-git-1.0.2/.hgsigs 2023-03-06 10:42:18.000000000 +0100 +++ new/hg-git-1.0.3/.hgsigs 2023-11-07 17:11:05.000000000 +0100 @@ -24,3 +24,4 @@ d31a72cf70bd402aa5d3d4270871fff83ac47cd0 0 iHUEABYIAB0WIQRBf9ypgVcBvOhGUkSirMgbQc9ONAUCYioVGgAKCRCirMgbQc9ONNXKAP9vxsKN7H1cK45yewQ7hkbod1PQfrhfXKp+XJoonOaeuAEApfmJsYzh9nQQ6xfVX2RhFyjqEdKoCLEJPGcoE/FLRwA= 6f22e3887d8220863620664077c8554da9d487c4 0 iHUEABYIAB0WIQRBf9ypgVcBvOhGUkSirMgbQc9ONAUCYkiYYQAKCRCirMgbQc9ONJpxAQCJk/7x/461bgYzDVC/4ugU1KnlgKjOprn9GE4m7MuuBQD9EPkQsuP8hjJ3HvNX+xQhnBGlwlQf1EYQBSuSaTOw+Qg= 3ca3ee14a659a96c3f593567fc0dc3d735e06c28 0 iHUEABYIAB0WIQRBf9ypgVcBvOhGUkSirMgbQc9ONAUCY2VrkgAKCRCirMgbQc9ONLILAQD1uMUeOHc9eD2kXjy2fMeAisWljk8Cpn8OmbsY385/hAD/YdVePqhVK0zAqNBH56PNvv603TR+MDQu4cHS9ULo9wQ= +6582b75a71a413e95e7345ab0e6aa10a5c150711 0 iHUEABYIAB0WIQRBf9ypgVcBvOhGUkSirMgbQc9ONAUCZAIM/wAKCRCirMgbQc9ONHDhAQD6M6tlj5FDYY3iGtn3970WuU0MKDjtnYEQIef0yo+pawEA7s1AHYXtqdEcjJnKje5L+8IkYdsDF15/SiPuYMFGjgc= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/.hgtags new/hg-git-1.0.3/.hgtags --- old/hg-git-1.0.2/.hgtags 2023-03-06 10:42:18.000000000 +0100 +++ new/hg-git-1.0.3/.hgtags 2023-11-07 17:11:05.000000000 +0100 @@ -49,3 +49,4 @@ 6f22e3887d8220863620664077c8554da9d487c4 1.0.0 29d1515aac3bbdd9cfc5e4ea4797bb5b45d3afe1 1.0.1 3ca3ee14a659a96c3f593567fc0dc3d735e06c28 1.0.1 +6582b75a71a413e95e7345ab0e6aa10a5c150711 1.0.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/NEWS.rst new/hg-git-1.0.3/NEWS.rst --- old/hg-git-1.0.2/NEWS.rst 2023-03-03 16:06:19.000000000 +0100 +++ new/hg-git-1.0.3/NEWS.rst 2023-11-07 17:11:05.000000000 +0100 @@ -1,3 +1,14 @@ +hg-git 1.0.3 (unreleased) +========================= + +This is a minor release, focusing on bugs and compatibility. + +* Fix tests with Mercurial 6.5 +* Handle failures to save refs, such as when they use characters + forbidden by the file system; this is most easily noticed on Windows + and macOS. (#397) +* Fix pulling annotated tags with ``-r``/``--rev``. + hg-git 1.0.2 (2023-03-03) ========================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/PKG-INFO new/hg-git-1.0.3/PKG-INFO --- old/hg-git-1.0.2/PKG-INFO 2023-03-06 10:44:44.752856500 +0100 +++ new/hg-git-1.0.3/PKG-INFO 2023-11-07 17:13:28.403610500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hg-git -Version: 1.0.2 +Version: 1.0.3 Summary: push to and pull from a Git repository using Mercurial Home-page: http://foss.heptapod.net/mercurial/hg-git Author: Scott Chacon, Augie Fackler, Kevin Bullock and others @@ -11,6 +11,7 @@ Requires-Python: >=3.6 Description-Content-Type: text/x-rst License-File: COPYING +Requires-Dist: dulwich<0.22.0,>=0.19.3 Hg-Git Mercurial Plugin ======================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/contrib/hggitperf.py new/hg-git-1.0.3/contrib/hggitperf.py --- old/hg-git-1.0.2/contrib/hggitperf.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/contrib/hggitperf.py 2023-11-07 16:55:14.000000000 +0100 @@ -14,6 +14,7 @@ cmdtable = {} command = cmdutil.command(cmdtable) + # the timer functions are copied from mercurial/contrib/perf.py def gettimer(ui, opts=None): """return a timer function and formatter: (timer, formatter) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hg_git.egg-info/PKG-INFO new/hg-git-1.0.3/hg_git.egg-info/PKG-INFO --- old/hg-git-1.0.2/hg_git.egg-info/PKG-INFO 2023-03-06 10:44:44.000000000 +0100 +++ new/hg-git-1.0.3/hg_git.egg-info/PKG-INFO 2023-11-07 17:13:28.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hg-git -Version: 1.0.2 +Version: 1.0.3 Summary: push to and pull from a Git repository using Mercurial Home-page: http://foss.heptapod.net/mercurial/hg-git Author: Scott Chacon, Augie Fackler, Kevin Bullock and others @@ -11,6 +11,7 @@ Requires-Python: >=3.6 Description-Content-Type: text/x-rst License-File: COPYING +Requires-Dist: dulwich<0.22.0,>=0.19.3 Hg-Git Mercurial Plugin ======================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hg_git.egg-info/SOURCES.txt new/hg-git-1.0.3/hg_git.egg-info/SOURCES.txt --- old/hg-git-1.0.2/hg_git.egg-info/SOURCES.txt 2023-03-06 10:44:44.000000000 +0100 +++ new/hg-git-1.0.3/hg_git.egg-info/SOURCES.txt 2023-11-07 17:13:28.000000000 +0100 @@ -49,7 +49,6 @@ hggit/overlay.py hggit/revsets.py hggit/schemes.py -hggit/state.py hggit/templates.py hggit/util.py hggit/verify.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/__init__.py new/hg-git-1.0.3/hggit/__init__.py --- old/hg-git-1.0.2/hggit/__init__.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/__init__.py 2023-11-07 16:55:14.000000000 +0100 @@ -162,7 +162,7 @@ b'collections', } -testedwith = b'5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4' +testedwith = b'5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5' minimumhgversion = b'5.2' buglink = b'https://foss.heptapod.net/mercurial/hg-git/issues' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/__version__.py new/hg-git-1.0.3/hggit/__version__.py --- old/hg-git-1.0.2/hggit/__version__.py 2023-03-06 10:44:44.000000000 +0100 +++ new/hg-git-1.0.3/hggit/__version__.py 2023-11-07 17:13:28.000000000 +0100 @@ -1,4 +1,16 @@ # file generated by setuptools_scm # don't change, don't track in version control -__version__ = version = '1.0.2' -__version_tuple__ = version_tuple = (1, 0, 2) +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = '1.0.3' +__version_tuple__ = version_tuple = (1, 0, 3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/compat.py new/hg-git-1.0.3/hggit/compat.py --- old/hg-git-1.0.2/hggit/compat.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/compat.py 2023-11-07 16:55:14.000000000 +0100 @@ -15,6 +15,7 @@ from dulwich import object_store from dulwich import pack + # dulwich 0.20.49 changed create_delta to a generator def create_delta(base_buf, target_buf): delta = pack.create_delta(base_buf, target_buf) @@ -151,3 +152,13 @@ else: MissingObjectFinder = object_store.MissingObjectFinder + + +# dulwich 0.21 added a module-level function and deprecated the +# instance method +try: + peel_sha = object_store.peel_sha +except AttributeError: + + def peel_sha(store, sha): + return store[sha], store.peel_sha(sha) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/git_handler.py new/hg-git-1.0.3/hggit/git_handler.py --- old/hg-git-1.0.2/hggit/git_handler.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/git_handler.py 2023-11-07 16:55:14.000000000 +0100 @@ -157,7 +157,7 @@ def has_gitrepo(repo): - if not hgutil.safehasattr(repo, b'vfs'): + if not hasattr(repo, 'vfs'): return False repo, gitdir = get_repo_and_gitdir(repo) @@ -270,12 +270,13 @@ def map_hg_get(self, gitsha, deref=False): if deref: try: - gitobj = self.git.get_object(gitsha) + unpeeled, peeled = compat.peel_sha( + self.git.object_store, gitsha + ) + gitsha = peeled.id except KeyError: - gitobj = None - - if isinstance(gitobj, Tag): - gitsha = gitobj.object[1] + self.ui.note(b'note: failed to dereference %s\n' % gitsha) + return None return self._map_git.get(gitsha) @@ -527,7 +528,7 @@ new_refs_with_head.update( self.fetch_pack(remote, [b'HEAD']).refs, ) - except (error.RepoLookupError): + except error.RepoLookupError: self.ui.debug(b'remote repository has no HEAD\n') for remote_name in remote_names: @@ -832,7 +833,7 @@ if b'author' in ctx.extra(): try: author = b"".join(apply_delta(author, ctx.extra()[b'author'])) - except ApplyDeltaError: + except (ApplyDeltaError, AssertionError): self.ui.traceback() self.ui.warn( b"warning: disregarding possibly invalid metadata in %s\n" @@ -868,7 +869,7 @@ if b'message' in extra: try: message = b"".join(apply_delta(message, extra[b'message'])) - except ApplyDeltaError: + except (ApplyDeltaError, AssertionError): self.ui.traceback() self.ui.warn( b"warning: disregarding possibly invalid metadata in %s\n" @@ -1143,7 +1144,7 @@ hgsub = util.parse_hgsub( git2hg.git_file_readlines(self.git, git_commit_tree, b'.hgsub') ) - for (sm_path, sm_url, sm_name) in gitmodules: + for sm_path, sm_url, sm_name in gitmodules: hgsub[sm_path] = b'[git]' + sm_url files[b'.hgsub'] = (False, 0o100644, None) elif ( @@ -1462,11 +1463,16 @@ for ref in rev_refs: if ref not in refs: - gitobj = self.git.get_object(self.git.refs[ref]) - if isinstance(gitobj, Tag): - new_refs[ref] = gitobj.id + if ref not in self.git.refs: + self.ui.note( + b'note: cannot update %s\n' % (ref), + ) else: - new_refs[ref] = self.map_git_get(ctx.hex()) + gitobj = self.git.get_object(self.git.refs[ref]) + if isinstance(gitobj, Tag): + new_refs[ref] = gitobj.id + else: + new_refs[ref] = self.map_git_get(ctx.hex()) elif new_refs[ref] in self._map_git: rctx = unfiltered[self.map_hg_get(new_refs[ref])] if rctx.ancestor(ctx) == rctx or force: @@ -1644,8 +1650,11 @@ reftarget = self.git.refs[tag_refname] try: peeledtarget = self.git.get_peeled(tag_refname) - except KeyError as e: - peeledtarget = e.args[0] + except KeyError: + self.ui.note( + b'note: failed to peel tag %s' % (tag_refname) + ) + peeledtarget = None if peeledtarget != reftarget: # warn the user if they tried changing the tag @@ -1719,19 +1728,18 @@ return repotags = self.repo.tags() for k in refs: - ref_name = k - parts = k.split(b'/') - if parts[0] == b'refs' and parts[1] == b'tags': - ref_name = b"/".join(v for v in parts[2:]) + if k.startswith(LOCAL_TAG_PREFIX): + ref_name = k[len(LOCAL_TAG_PREFIX) :] + # refs contains all the refs in the server, not just # the ones we are pulling if refs[k] not in self.git.object_store: continue - if ref_name[-3:] == ANNOTATED_TAG_SUFFIX: - ref_name = ref_name[:-3] + if ref_name.endswith(ANNOTATED_TAG_SUFFIX): + continue if ref_name not in repotags: sha = self.map_hg_get(refs[k], deref=True) - if sha is not None: + if sha is not None and sha is not None: self.tags[ref_name] = sha self.save_tags() @@ -1890,23 +1898,27 @@ all_remote_nodeids = [] for ref_name, sha in refs.items(): - hgsha = self.map_hg_get(sha) + if ref_name.endswith(ANNOTATED_TAG_SUFFIX): + # the sha points to a peeled tag; we should either + # pick it up through the tag itself, or ignore it + continue + + hgsha = self.map_hg_get(sha, deref=True) if ( ref_name.startswith(LOCAL_BRANCH_PREFIX) and hgsha is not None and hgsha in self.repo ): - head = ref_name[11:] + head = ref_name[len(LOCAL_BRANCH_PREFIX) :] remote_head = b'/'.join((remote_name, head)) remote_refs[remote_head] = bin(hgsha) # TODO(durin42): what is this doing? new_ref = REMOTE_BRANCH_PREFIX + remote_head + util.set_refs(self.ui, self.git, {new_ref: sha}) - elif ref_name.startswith( - LOCAL_TAG_PREFIX - ) and not ref_name.endswith(ANNOTATED_TAG_SUFFIX): + elif ref_name.startswith(LOCAL_TAG_PREFIX): util.set_refs(self.ui, self.git, {ref_name: sha}) if hgsha: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/gitrepo.py new/hg-git-1.0.3/hggit/gitrepo.py --- old/hg-git-1.0.2/hggit/gitrepo.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/gitrepo.py 2023-11-07 16:55:14.000000000 +0100 @@ -103,7 +103,7 @@ def known(self): raise NotImplementedError - def peer(self, path=None): + def peer(self, path=None, remotehidden=False): return self def stream_out(self): @@ -135,9 +135,9 @@ # defend against tracebacks if we specify -r in 'hg pull' -@eh.wrapfunction(hg, b'addbranchrevs') -def safebranchrevs(orig, lrepo, otherrepo, branches, revs): - revs, co = orig(lrepo, otherrepo, branches, revs) +@eh.wrapfunction(hg, 'addbranchrevs') +def safebranchrevs(orig, lrepo, otherrepo, branches, revs, **kwargs): + revs, co = orig(lrepo, otherrepo, branches, revs, **kwargs) if isinstance(otherrepo, gitrepo): # FIXME: Unless it's None, the 'co' result is passed to the lookup() # remote command. Since our implementation of the lookup() remote @@ -151,7 +151,7 @@ return revs, co -@eh.wrapfunction(discovery, b'findcommonoutgoing') +@eh.wrapfunction(discovery, 'findcommonoutgoing') def findcommonoutgoing(orig, repo, other, *args, **kwargs): if isinstance(other, gitrepo): heads = repo.githandler.get_refs(other.path)[0] @@ -172,14 +172,14 @@ return orig(repo, other, *args, **kwargs) -@eh.wrapfunction(bundlerepo, b'getremotechanges') +@eh.wrapfunction(bundlerepo, 'getremotechanges') def getremotechanges(orig, ui, repo, other, onlyheads, *args, **opts): if isinstance(other, gitrepo): return repo.githandler.getremotechanges(other, onlyheads) return orig(ui, repo, other, onlyheads, *args, **opts) -@eh.wrapfunction(exchange, b'pull') +@eh.wrapfunction(exchange, 'pull') @util.transform_notgit def exchangepull( orig, repo, remote, heads=None, force=False, bookmarks=(), **kwargs @@ -207,7 +207,7 @@ # TODO figure out something useful to do with the newbranch param -@eh.wrapfunction(exchange, b'push') +@eh.wrapfunction(exchange, 'push') @util.transform_notgit def exchangepush( orig, @@ -245,5 +245,7 @@ ) -def make_peer(ui, path, create, intents=None, createopts=None): +def make_peer( + ui, path, create, intents=None, createopts=None, remotehidden=False +): return gitrepo(ui, path, create) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/hgrepo.py new/hg-git-1.0.3/hggit/hgrepo.py --- old/hg-git-1.0.2/hggit/hgrepo.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/hgrepo.py 2023-11-07 16:55:14.000000000 +0100 @@ -74,7 +74,7 @@ repo.__class__ = hgrepo -@eh.wrapfunction(repoview, b'pinnedrevs') +@eh.wrapfunction(repoview, 'pinnedrevs') def pinnedrevs(orig, repo): pinned = orig(repo) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/overlay.py new/hg-git-1.0.3/hggit/overlay.py --- old/hg-git-1.0.2/hggit/overlay.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/overlay.py 2023-11-07 16:55:14.000000000 +0100 @@ -155,7 +155,7 @@ del self._map[path] -@eh.wrapfunction(manifest.manifestdict, b'diff') +@eh.wrapfunction(manifest.manifestdict, 'diff') def wrapmanifestdictdiff(orig, self, m2, match=None, clean=False): '''avoid calling into lazymanifest code if m2 is an overlaymanifest''' # Older mercurial clients used diff(m2, clean=False). If a caller failed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/schemes.py new/hg-git-1.0.3/hggit/schemes.py --- old/hg-git-1.0.2/hggit/schemes.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/schemes.py 2023-11-07 16:55:14.000000000 +0100 @@ -99,7 +99,7 @@ return fn(ui, path, *args, **kwargs) -@eh.wrapfunction(hg, b'defaultdest') +@eh.wrapfunction(hg, 'defaultdest') def defaultdest(orig, source): if source.endswith(b'.git'): return orig(source[:-4]) @@ -107,7 +107,7 @@ return orig(source) -@eh.wrapfunction(hg, b'peer') +@eh.wrapfunction(hg, 'peer') def peer(orig, uiorrepo, *args, **opts): newpeer = orig(uiorrepo, *args, **opts) if isinstance(newpeer, gitrepo.gitrepo): @@ -116,7 +116,7 @@ return newpeer -@eh.wrapfunction(hg, b'clone') +@eh.wrapfunction(hg, 'clone') def clone(orig, *args, **opts): srcpeer, destpeer = orig(*args, **opts) @@ -127,24 +127,24 @@ return srcpeer, destpeer -@eh.wrapfunction(compat.path, b'_isvalidlocalpath') +@eh.wrapfunction(compat.path, '_isvalidlocalpath') def isvalidlocalpath(orig, self, path): return orig(self, path) or isgitdir(path) -@eh.wrapfunction(compat.url, b'islocal') +@eh.wrapfunction(compat.url, 'islocal') def isurllocal(orig, path): # recognise git scp-style paths when cloning return orig(path) and not util.isgitsshuri(path._origpath) -@eh.wrapfunction(hg, b'islocal') +@eh.wrapfunction(hg, 'islocal') def islocal(orig, path): # recognise git scp-style paths when cloning return orig(path) and not util.isgitsshuri(path) -@eh.wrapfunction(compat.urlutil, b'hasscheme') +@eh.wrapfunction(compat.urlutil, 'hasscheme') def hasscheme(orig, path): # recognise git scp-style paths return orig(path) or util.isgitsshuri(path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/state.py new/hg-git-1.0.3/hggit/state.py --- old/hg-git-1.0.2/hggit/state.py 2022-11-28 13:25:40.000000000 +0100 +++ new/hg-git-1.0.3/hggit/state.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,88 +0,0 @@ -import collections.abc -import typing - -from mercurial import ( - hg, - localrepo, - ui, - util as hgutil, -) - -MAP_FILE_NAME = b"git-mapfile" - - -def get_repo_and_gitdir(repo): - if repo.shared(): - repo = hg.sharedreposource(repo) - - if repo.ui.configbool(b"git", b"intree"): - gitdir = repo.wvfs.join(b".git") - else: - gitdir = repo.vfs.join(b"git") - - return repo, gitdir - - -class State(collections.abc.Mapping): - def __init__(self, ui, repo): - super().__init__() - - self.ui = ui - self.store_repo, self.gitdir = get_repo_and_gitdir(repo) - self.vfs = self.store_repo.vfs - - def __bool__(self): - return bool(self.__oneway_map) - - @hgutil.propertycache - def __onewaymap(self): - return dict(self.load(ui, repo)) - - @hgutil.propertycache - def __twowaymap(self): - r = self.__onewaymap.copy() - r.update(map(reversed, r.items())) - - return r - - def __getitem__(self, item): - return self.__twoway_map[item] - - def set(self, gitsha, hgsha): - self.__oneway_map[gitsha] = hgsha - self.__twoway_map[gitsha] = hgsha - self.__twoway_map[hgsha] = gitsha - - def __getitem__(self, item): - return self.__twoway_map[item] - - def __iter__(self): - return iter(self.__oneway_map) - - def __len__(self): - return len(self.__oneway_map) - - @abc.abstractmethod - def load(self) -> typing.Iterator[(bytes, bytes)]: - pass - - @abc.abstractmethod - def save(self, tr) -> typing.Iterator[(bytes, bytes)]: - pass - - -class LegacyState(AbstractState): - def load(self): - if os.path.exists(self.vfs.join(self.map_file)): - for line in self.vfs(self.map_file): - # format is <40 hex digits> <40 hex digits>\n - if len(line) != 82: - raise ValueError( - _(b"corrupt mapfile: incorrect line length %d") - % len(line) - ) - yield line[:40], line[41:81] - map_git_real[gitsha] = hgsha - map_hg_real[hgsha] = gitsha - self._map_git_real = map_git_real - self._map_hg_real = map_hg_real diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/hggit/util.py new/hg-git-1.0.3/hggit/util.py --- old/hg-git-1.0.2/hggit/util.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/hggit/util.py 2023-11-07 16:55:14.000000000 +0100 @@ -190,25 +190,27 @@ def set_refs(ui, git, refs): for git_ref, git_sha in refs.items(): - # prior to 0.20.22, dulwich couldn't handle refs - # pointing to missing objects, so don't add them - # - # moreover, don't set the ref if it already points to the - # target object since setting the ref triggers a fsync, which - # can be very slow in large repositories - if ( - git_sha - and git_sha in git - and git.refs.follow(git_ref)[1] != git_sha - ): + try: + # prior to 0.20.22, dulwich couldn't handle refs pointing + # to missing objects, so don't add them + # + # moreover, don't set the ref if it already points to the + # target object since setting the ref triggers a fsync, + # which can be very slow in large repositories + if ( + git_sha + and git_sha in git + and git.refs.follow(git_ref)[1] != git_sha + ): + git.refs[git_ref] = git_sha + except OSError: # some refs may actually be unstorable, e.g. refs # containing a double quote on Windows or non-UTF-8 refs - # on macOS, so handle that gracefully - try: - git.refs[git_ref] = git_sha - except OSError: - ui.traceback() - ui.warn(b"warning: failed to save ref %s\n" % git_ref) + # on macOS, so handle that gracefully -- and older + # versions of Dulwich don't even handle _checking_ for + # those refs + ui.traceback() + ui.warn(b"warning: failed to save ref %s\n" % git_ref) def ref_exists(ref: bytes, container): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/pyproject.toml new/hg-git-1.0.3/pyproject.toml --- old/hg-git-1.0.2/pyproject.toml 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/pyproject.toml 2023-11-07 16:55:14.000000000 +0100 @@ -21,5 +21,6 @@ | \.mypy_cache/ | \.venv/ | tests/ +| hggit/__version__.py ''' skip-string-normalization = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/tests/hghave.py new/hg-git-1.0.3/tests/hghave.py --- old/hg-git-1.0.2/tests/hghave.py 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/tests/hghave.py 2023-11-07 16:55:14.000000000 +0100 @@ -641,7 +641,14 @@ @check("pylint", "Pylint python linter") def has_pylint(): - return matchoutput("pylint --help", br"Usage:[ ]+pylint", True) + try: + import pylint + + pylint.__version__ + except ImportError: + return False + else: + return True @check("clang-format", "clang-format C code formatter (>= 11)") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/tests/test-encoding.t new/hg-git-1.0.3/tests/test-encoding.t --- old/hg-git-1.0.2/tests/test-encoding.t 2023-03-03 16:05:56.000000000 +0100 +++ new/hg-git-1.0.3/tests/test-encoding.t 2023-11-07 16:55:14.000000000 +0100 @@ -234,19 +234,19 @@ warning: not exporting tag 'uni-t?g' due to invalid name warning: not exporting tag 'lat-t?g' due to invalid name searching for changes + remote: found 0 deltas to reuse (dulwich0210 !) adding reference refs/tags/ascii-tag $ HGENCODING=latin-1 hg push pushing to $TESTTMP/repo.git warning: failed to save ref refs/tags/lat-t\xe4g (esc) warning: failed to save ref refs/tags/uni-t\xe4g (esc) searching for changes - warning: cannot update 'refs/tags/uni-t\xe4g' (esc) - warning: cannot update 'refs/tags/lat-t\xe4g' (esc) no changes found (ignoring 1 changesets without bookmarks or tags) [1] $ HGENCODING=utf-8 hg push pushing to $TESTTMP/repo.git searching for changes + remote: found 0 deltas to reuse (dulwich0210 !) adding reference refs/tags/lat-t\xc3\xa4g (esc) adding reference refs/tags/uni-t\xc3\xa4g (esc) #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/tests/test-git-tags.t new/hg-git-1.0.3/tests/test-git-tags.t --- old/hg-git-1.0.2/tests/test-git-tags.t 2023-03-03 12:16:51.000000000 +0100 +++ new/hg-git-1.0.3/tests/test-git-tags.t 2023-11-07 16:55:14.000000000 +0100 @@ -263,6 +263,7 @@ beta 1:7fe02317c63d git alpha 0:ff7a2f2d8d70 git #endif + $ hg book not-master $ hg tag beta abort: tag 'beta' already exists (use -f to force) [255] @@ -277,11 +278,12 @@ adding objects remote: found 0 deltas to reuse (dulwich0210 !) added 1 commits with 1 trees and 1 blobs - updating reference refs/heads/master + adding reference refs/heads/not-master $ hg tags tip 5:c49682c7cba4 - default/master 5:c49682c7cba4 + default/not-master 5:c49682c7cba4 gamma 4:0eb1ab0073a8 + default/master 4:0eb1ab0073a8 beta 4:0eb1ab0073a8 detached 2:61175962e488 alpha 0:ff7a2f2d8d70 @@ -295,8 +297,9 @@ importing 6 git commits $ hg tags -q tip - default/master + default/not-master gamma + default/master beta detached alpha @@ -305,27 +308,31 @@ Test how pulling an explicit branch with an annotated tag: $ hg clone -r master repo.git hgrepo-2 - importing 5 git commits - new changesets ff7a2f2d8d70:c49682c7cba4 (5 drafts) + importing 4 git commits + new changesets ff7a2f2d8d70:0eb1ab0073a8 (4 drafts) updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r 'ancestors(master) and tagged()' -T shorttags -R hgrepo-2 0:ff7a2f2d8d70 draft alpha - 3:0eb1ab0073a8 draft beta gamma - 4:c49682c7cba4 draft default/master tip + 3:0eb1ab0073a8 draft default/master gamma tip $ rm -rf hgrepo-2 $ hg clone -r master repo.git hgrepo-2 - importing 5 git commits - new changesets ff7a2f2d8d70:c49682c7cba4 (5 drafts) + importing 4 git commits + new changesets ff7a2f2d8d70:0eb1ab0073a8 (4 drafts) updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r 'tagged()' -T shorttags -R hgrepo-2 0:ff7a2f2d8d70 draft alpha - 3:0eb1ab0073a8 draft beta gamma - 4:c49682c7cba4 draft default/master tip + 3:0eb1ab0073a8 draft default/master gamma tip This used to die: $ hg -R hgrepo-2 gexport +This used to fail, since we didn't actually pull the annotated tag: + $ hg -R hgrepo-2 push + pushing to $TESTTMP/repo.git + searching for changes + no changes found + [1] $ rm -rf hgrepo-2 Check that pulling will update phases only: @@ -336,6 +343,6 @@ pulling from $TESTTMP/repo.git no changes found $ hg log -T shorttags -r gamma -r detached - 4:0eb1ab0073a8 draft beta gamma + 4:0eb1ab0073a8 draft beta default/master gamma 2:61175962e488 draft detached X $ cd .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-1.0.2/tests/test-orphan-tags.t new/hg-git-1.0.3/tests/test-orphan-tags.t --- old/hg-git-1.0.2/tests/test-orphan-tags.t 2023-03-03 12:16:51.000000000 +0100 +++ new/hg-git-1.0.3/tests/test-orphan-tags.t 2023-11-07 16:50:01.000000000 +0100 @@ -59,7 +59,7 @@ $ cd .. Create a Mercurial clone -n + $ hg clone -U repo.git hgrepo importing 4 git commits new changesets b8e77484829b:387d03400596 (4 drafts)