Hello community, here is the log from the commit of package hg-git for openSUSE:Factory checked in at 2015-12-09 19:52:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hg-git (Old) and /work/SRC/openSUSE:Factory/.hg-git.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hg-git" Changes: -------- --- /work/SRC/openSUSE:Factory/hg-git/hg-git.changes 2015-10-06 13:26:44.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.hg-git.new/hg-git.changes 2015-12-09 22:19:15.000000000 +0100 @@ -1,0 +2,9 @@ +Mon Dec 7 08:11:04 UTC 2015 - devel...@develop7.info + +- update to v0.8.3 + * fixes Mercurial 3.6 compatibility issues + * Other changes: see https://bitbucket.org/durin42/hg-git/branches/compare/0.8.3%0D0.8.2 +- use %version macro +- remove unused %rev define + +------------------------------------------------------------------- Old: ---- hg-git-0.8.2.tar.gz New: ---- hg-git-0.8.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hg-git.spec ++++++ --- /var/tmp/diff_new_pack.sZkAQX/_old 2015-12-09 22:19:16.000000000 +0100 +++ /var/tmp/diff_new_pack.sZkAQX/_new 2015-12-09 22:19:16.000000000 +0100 @@ -16,16 +16,14 @@ # -%define rev cf3dafce0611 - Name: hg-git -Version: 0.8.2 +Version: 0.8.3 Release: 0 Summary: Mercurial Plugin for Communicating with Git Servers License: GPL-2.0+ Group: Development/Tools/Version Control -Url: https://pypi.python.org/pypi/hg-git/ -Source0: https://pypi.python.org/packages/source/h/hg-git/hg-git-0.8.2.tar.gz +Url: https://bitbucket.org/durin42/hg-git/ +Source0: https://pypi.python.org/packages/source/h/hg-git/hg-git-%{version}.tar.gz BuildRequires: mercurial BuildRequires: python-devel BuildRequires: python-dulwich >= 0.9.7 ++++++ hg-git-0.8.2.tar.gz -> hg-git-0.8.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/PKG-INFO new/hg-git-0.8.3/PKG-INFO --- old/hg-git-0.8.2/PKG-INFO 2015-08-11 23:24:14.000000000 +0200 +++ new/hg-git-0.8.3/PKG-INFO 2015-11-09 06:44:33.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: hg-git -Version: 0.8.2 +Version: 0.8.3 Summary: push to and pull from a Git repository using Mercurial Home-page: http://hg-git.github.com/ Author: Augie Fackler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/README.md new/hg-git-0.8.3/README.md --- old/hg-git-0.8.2/README.md 2014-12-05 18:50:48.000000000 +0100 +++ new/hg-git-0.8.3/README.md 2015-11-09 06:39:39.000000000 +0100 @@ -137,12 +137,7 @@ That will enable the Hg-Git extension for you. -This plugin is currently tested against the following Mercurial versions: - - * 2.0.2 - * 2.1.2 - * 2.2.3 - * 2.3.1 +See the Makefile for a list of compatible Mercurial versions. Configuration ============= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hg_git.egg-info/PKG-INFO new/hg-git-0.8.3/hg_git.egg-info/PKG-INFO --- old/hg-git-0.8.2/hg_git.egg-info/PKG-INFO 2015-08-11 23:24:13.000000000 +0200 +++ new/hg-git-0.8.3/hg_git.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -Metadata-Version: 1.0 -Name: hg-git -Version: 0.8.2 -Summary: push to and pull from a Git repository using Mercurial -Home-page: http://hg-git.github.com/ -Author: Augie Fackler -Author-email: duri...@gmail.com -License: GPLv2 -Description: This extension lets you communicate (push and pull) with a Git server. - This way you can use Git hosting for your project or collaborate with a - project that is in Git. A bridger of worlds, this plugin be. -Keywords: hg git mercurial -Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hg_git.egg-info/SOURCES.txt new/hg-git-0.8.3/hg_git.egg-info/SOURCES.txt --- old/hg-git-0.8.2/hg_git.egg-info/SOURCES.txt 2015-08-11 23:24:13.000000000 +0200 +++ new/hg-git-0.8.3/hg_git.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,22 +0,0 @@ -COPYING -MANIFEST.in -README.md -setup.py -hg_git.egg-info/PKG-INFO -hg_git.egg-info/SOURCES.txt -hg_git.egg-info/dependency_links.txt -hg_git.egg-info/requires.txt -hg_git.egg-info/top_level.txt -hggit/__init__.py -hggit/_ssh.py -hggit/compat.py -hggit/git2hg.py -hggit/git_handler.py -hggit/gitdirstate.py -hggit/gitrepo.py -hggit/hg2git.py -hggit/hgrepo.py -hggit/overlay.py -hggit/util.py -hggit/verify.py -hggit/help/git.rst \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hg_git.egg-info/dependency_links.txt new/hg-git-0.8.3/hg_git.egg-info/dependency_links.txt --- old/hg-git-0.8.2/hg_git.egg-info/dependency_links.txt 2015-08-11 23:24:13.000000000 +0200 +++ new/hg-git-0.8.3/hg_git.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hg_git.egg-info/requires.txt new/hg-git-0.8.3/hg_git.egg-info/requires.txt --- old/hg-git-0.8.2/hg_git.egg-info/requires.txt 2015-08-11 23:24:13.000000000 +0200 +++ new/hg-git-0.8.3/hg_git.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -dulwich>=0.9.7 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hg_git.egg-info/top_level.txt new/hg-git-0.8.3/hg_git.egg-info/top_level.txt --- old/hg-git-0.8.2/hg_git.egg-info/top_level.txt 2015-08-11 23:24:13.000000000 +0200 +++ new/hg-git-0.8.3/hg_git.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -hggit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hggit/__init__.py new/hg-git-0.8.3/hggit/__init__.py --- old/hg-git-0.8.2/hggit/__init__.py 2015-08-11 23:23:51.000000000 +0200 +++ new/hg-git-0.8.3/hggit/__init__.py 2015-11-09 06:41:16.000000000 +0100 @@ -42,6 +42,7 @@ from mercurial import revset from mercurial import scmutil from mercurial import templatekw +from mercurial import ui as hgui from mercurial import util as hgutil from mercurial.node import hex from mercurial.i18n import _ @@ -61,13 +62,21 @@ # The ignore module disappeared in Mercurial 3.5 ignoremod = False +baseset = set +try: + baseset = revset.baseset +except AttributeError: + # baseset was added in hg 3.0 + pass + + demandimport.ignore.extend([ 'collections', ]) -__version__ = '0.8.2' +__version__ = '0.8.3' -testedwith = '2.8.2 3.0.1 3.1 3.2.2 3.3 3.4' +testedwith = '2.8.2 3.0.1 3.1 3.2.2 3.3 3.4 3.5 3.6' buglink = 'https://bitbucket.org/durin42/hg-git/issues' cmdtable = {} @@ -91,16 +100,26 @@ def localpath(self): return self.p +def _isgitdir(path): + """True if the given file path is a git repo.""" + if os.path.exists(os.path.join(path, '.hg')): + return False + + if os.path.exists(os.path.join(path, '.git')): + # is full git repo + return True + + if (os.path.exists(os.path.join(path, 'HEAD')) and + os.path.exists(os.path.join(path, 'objects')) and + os.path.exists(os.path.join(path, 'refs'))): + # is bare git repo + return True + + return False + def _local(path): p = urlcls(path).localpath() - if (os.path.exists(os.path.join(p, '.git')) and - not os.path.exists(os.path.join(p, '.hg'))): - return gitrepo - # detect a bare repository - if (os.path.exists(os.path.join(p, 'HEAD')) and - os.path.exists(os.path.join(p, 'objects')) and - os.path.exists(os.path.join(p, 'refs')) and - not os.path.exists(os.path.join(p, '.hg'))): + if _isgitdir(p): return gitrepo # detect git ssh urls (which mercurial thinks is a file-like path) if util.isgitsshuri(p): @@ -109,6 +128,26 @@ hg.schemes['file'] = _local +# we need to wrap this so that git-like ssh paths are not prepended with a +# local filesystem path. ugh. +def _url(orig, path, **kwargs): + # we'll test for 'git@' then use our heuristic method to determine if it's + # a git uri + if not (path.startswith(os.sep) and ':' in path): + return orig(path, **kwargs) + + # the file path will be everything up until the last slash right before the + # ':' + lastsep = path.rindex(os.sep, None, path.index(':')) + 1 + gituri = path[lastsep:] + + if util.isgitsshuri(gituri): + return orig(gituri, **kwargs) + return orig(path, **kwargs) + +extensions.wrapfunction(hgutil, 'url', _url) + + def _httpgitwrapper(orig): # we should probably test the connection but for now, we just keep it # simple and check for a url ending in '.git' @@ -158,7 +197,8 @@ }) helpdir = os.path.join(os.path.dirname(__file__), 'help') entry = (['git'], _("Working with Git Repositories"), - lambda: open(os.path.join(helpdir, 'git.rst')).read()) + # Mercurial >= 3.6: doc(ui) + lambda *args: open(os.path.join(helpdir, 'git.rst')).read()) insort(help.helptable, entry) def reposetup(ui, repo): @@ -263,6 +303,12 @@ return newpeer extensions.wrapfunction(hg, 'peer', peer) +def isvalidlocalpath(orig, self, path): + return orig(self, path) or _isgitdir(path) +if (hgutil.safehasattr(hgui, 'path') and + hgutil.safehasattr(hgui.path, '_isvalidlocalpath')): + extensions.wrapfunction(hgui.path, '_isvalidlocalpath', isvalidlocalpath) + @util.transform_notgit def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=(), **kwargs): @@ -301,14 +347,19 @@ # TODO figure out something useful to do with the newbranch param @util.transform_notgit def exchangepush(orig, repo, remote, force=False, revs=None, newbranch=False, - bookmarks=()): + bookmarks=(), **kwargs): if isinstance(remote, gitrepo.gitrepo): + # opargs is in Mercurial >= 3.6 + opargs = kwargs.get('opargs') + if opargs is None: + opargs = {} pushop = exchange.pushoperation(repo, remote, force, revs, newbranch, - bookmarks) + bookmarks, **opargs) pushop.cgresult = repo.githandler.push(remote.path, revs, force) return pushop else: - return orig(repo, remote, force, revs, newbranch, bookmarks=bookmarks) + return orig(repo, remote, force, revs, newbranch, bookmarks=bookmarks, + **kwargs) if not hgutil.safehasattr(localrepo.localrepository, 'push'): # Mercurial >= 3.2 extensions.wrapfunction(exchange, 'push', exchangepush) @@ -320,7 +371,8 @@ revset.getargs(x, 0, 0, "fromgit takes no arguments") git = repo.githandler node = repo.changelog.node - return [r for r in subset if git.map_git_get(hex(node(r))) is not None] + return baseset(r for r in subset + if git.map_git_get(hex(node(r))) is not None) def revset_gitnode(repo, subset, x): '''``gitnode(hash)`` @@ -337,7 +389,7 @@ if gitnode is None: return False return rev in [gitnode, gitnode[:12]] - return [r for r in subset if matches(r)] + return baseset(r for r in subset if matches(r)) def gitnodekw(**args): """:gitnode: String. The Git changeset identification hash, as a 40 hexadecimal digit string.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hggit/_ssh.py new/hg-git-0.8.3/hggit/_ssh.py --- old/hg-git-0.8.2/hggit/_ssh.py 2015-04-30 00:06:30.000000000 +0200 +++ new/hg-git-0.8.3/hggit/_ssh.py 2015-10-21 00:20:22.000000000 +0200 @@ -14,6 +14,11 @@ class _Vendor(SSHVendor): def run_command(self, host, command, username=None, port=None): + # newer dulwich changes the way they pass command and parameters + # around, so we detect that here and reformat it back to what + # hg-git expects (e.g. "command 'arg1 arg2'") + if len(command) > 1: + command = ["%s '%s'" % (command[0], ' '.join(command[1:]))] sshcmd = ui.config("ui", "ssh", "ssh") args = util.sshargs(sshcmd, host, username, port) cmd = '%s %s %s' % (sshcmd, args, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/hggit/git_handler.py new/hg-git-0.8.3/hggit/git_handler.py --- old/hg-git-0.8.2/hggit/git_handler.py 2015-08-11 23:10:12.000000000 +0200 +++ new/hg-git-0.8.3/hggit/git_handler.py 2015-10-07 22:18:25.000000000 +0200 @@ -15,15 +15,10 @@ from dulwich import config as dul_config from dulwich import diff_tree -try: - from mercurial import bookmarks - bookmarks.update - from mercurial import commands -except ImportError: - from hgext import bookmarks - from mercurial.i18n import _ from mercurial.node import hex, bin, nullid +from mercurial import bookmarks +from mercurial import commands from mercurial import context, util as hgutil from mercurial import url @@ -216,19 +211,26 @@ def load_remote_refs(self): self._remote_refs = {} - tagfile = self.repo.join(self.remote_refs_file) - if os.path.exists(tagfile): - tf = open(tagfile, 'rb') - tagdata = tf.read().split('\n') - td = [line.split(' ', 1) for line in tagdata if line] - self._remote_refs.update([(name, bin(sha)) for sha, name in td]) - - def save_remote_refs(self): - file = self.repo.opener(self.remote_refs_file, 'w+', atomictemp=True) - for tag, node in self.remote_refs.iteritems(): - file.write('%s %s\n' % (hex(node), tag)) - # If this complains, atomictempfile no longer has close - file.close() + refdir = os.path.join(self.git.path, 'refs', 'remotes') + + paths = self.paths + # if paths are set, we should still check 'default' + if not paths: + paths = [('default', None),] + + # we avoid using dulwich's refs method because it is incredibly slow; + # on a repo with a few hundred branches and a few thousand tags, + # dulwich took about 200ms + for p in paths: + remotedir = os.path.join(refdir, p[0]) + for root, dirs, files in os.walk(remotedir): + for f in files: + try: + ref = root.replace(refdir + os.sep, '') + '/' + node = open(os.path.join(root, f)).read().strip() + self._remote_refs[ref + f] = bin(self._map_git[node]) + except (KeyError, IOError): + pass # END FILE LOAD AND SAVE METHODS @@ -259,8 +261,8 @@ self.update_remote_branches('default', refs) # "Activate" a tipmost bookmark. - bms = getattr(self.repo['tip'], 'bookmarks', - lambda: None)() + bms = self.repo['tip'].bookmarks() + if bms: try: bookmarks.activate(self.repo, bms[0]) @@ -1031,6 +1033,8 @@ bookmarks.setcurrent(self.repo, 'master') new_refs['refs/heads/master'] = self.map_git_get(tip) + # mapped nodes might be hidden + unfiltered = self.repo.unfiltered() for rev, rev_refs in exportable.iteritems(): ctx = self.repo[rev] if not rev_refs: @@ -1064,7 +1068,7 @@ if ref not in refs: new_refs[ref] = self.map_git_get(ctx.hex()) elif new_refs[ref] in self._map_git: - rctx = self.repo[self.map_hg_get(new_refs[ref])] + rctx = unfiltered[self.map_hg_get(new_refs[ref])] if rctx.ancestor(ctx) == rctx or force: new_refs[ref] = self.map_git_get(ctx.hex()) else: @@ -1081,7 +1085,7 @@ return new_refs def fetch_pack(self, remote_name, heads=None): - client, path = self.get_transport_and_path(remote_name) + localclient, path = self.get_transport_and_path(remote_name) # The dulwich default walk only checks refs/heads/. We also want to # consider remotes when doing discovery, so we build our own list. We @@ -1099,8 +1103,8 @@ try: progress = GitProgress(self.ui) f = StringIO.StringIO() - ret = client.fetch_pack(path, determine_wants, graphwalker, - f.write, progress.progress) + ret = localclient.fetch_pack(path, determine_wants, graphwalker, + f.write, progress.progress) if(f.pos != 0): f.seek(0) self.git.object_store.add_thin_pack(f.read, None) @@ -1272,11 +1276,7 @@ def update_hg_bookmarks(self, refs): try: - oldbm = getattr(bookmarks, 'parse', None) - if oldbm: - bms = bookmarks.parse(self.repo) - else: - bms = self.repo._bookmarks + bms = self.repo._bookmarks heads = dict([(ref[11:], refs[ref]) for ref in refs if ref.startswith('refs/heads/')]) @@ -1299,14 +1299,11 @@ bms[head + suffix] = hgsha if heads: - if oldbm: - bookmarks.write(self.repo, bms) - else: - self.repo._bookmarks = bms - if getattr(bms, 'write', None): # hg >= 2.5 - bms.write() - else: # hg < 2.5 - bookmarks.write(self.repo) + wlock = self.repo.wlock() + try: + bms.write() + finally: + wlock.release() except AttributeError: self.ui.warn(_('creating bookmarks failed, do you have' @@ -1334,8 +1331,6 @@ ref_name.endswith('^{}')): self.git.refs[ref_name] = sha - self.save_remote_refs() - # UTILITY FUNCTIONS def convert_git_int_mode(self, mode): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hg-git-0.8.2/setup.cfg new/hg-git-0.8.3/setup.cfg --- old/hg-git-0.8.2/setup.cfg 2015-08-11 23:24:14.000000000 +0200 +++ new/hg-git-0.8.3/setup.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 -