# HG changeset patch # User Pierre-Yves David # Date 1439437119 25200 # Node ID 8f469f81129cb1dc5c1883a7bcb0a2151b0030d6 # Parent 3dec62fc266eff7c7aa20e3229ffbede1c33d208# Parent bc7eec65dfcff71425a6adfc16790d5e15cf1ba1 merge with stable diff -r 3dec62fc266e -r 8f469f81129c hgext/directaccess.py --- a/hgext/directaccess.py Mon Aug 10 00:44:53 2015 -0700 +++ b/hgext/directaccess.py Wed Aug 12 20:38:39 2015 -0700 @@ -13,6 +13,7 @@ from mercurial import error from mercurial import commands from mercurial import hg +from mercurial import util from mercurial.i18n import _ cmdtable = {} @@ -126,6 +127,8 @@ extensions.wrapfunction(hg, 'repository', _repository) setupdirectaccess() +hashre = util.re.compile('[0-9a-fA-F]{1,40}') + def gethashsymbols(tree): # Returns the list of symbols of the tree that look like hashes # for example for the revset 3::abe3ff it will return ('abe3ff') @@ -137,7 +140,9 @@ int(tree[1]) return [] except ValueError as e: - return [tree[1]] + if hashre.match(tree[1]): + return [tree[1]] + return [] elif len(tree) == 3: return gethashsymbols(tree[1]) + gethashsymbols(tree[2]) else: diff -r 3dec62fc266e -r 8f469f81129c hgext/inhibit.py --- a/hgext/inhibit.py Mon Aug 10 00:44:53 2015 -0700 +++ b/hgext/inhibit.py Wed Aug 12 20:38:39 2015 -0700 @@ -23,11 +23,15 @@ from mercurial import commands from mercurial import lock as lockmod from mercurial import bookmarks +from mercurial import util from mercurial.i18n import _ cmdtable = {} command = cmdutil.command(cmdtable) +def _inhibitenabled(repo): + return util.safehasattr(repo, '_obsinhibit') + def reposetup(ui, repo): class obsinhibitedrepo(repo.__class__): @@ -122,6 +126,9 @@ Content of and all mutable ancestors are considered. Marker for obsolete revision only are created. """ + if not _inhibitenabled(repo): + return + newinhibit = repo.set('::%ln and obsolete()', nodes) if newinhibit: lock = tr = None @@ -141,6 +148,9 @@ This will be triggered when inhibited nodes received new obsolescence markers. Otherwise the new obsolescence markers would also be inhibited. """ + if not _inhibitenabled(repo): + return + deinhibited = repo._obsinhibit & set(nodes) if deinhibited: tr = repo.transaction('obsinhibit') @@ -177,7 +187,7 @@ if visibleobsolete: _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) transaction = orig(repo, desc, *args, **kwargs) - if desc != 'strip': + if desc != 'strip' and _inhibitenabled(repo): transaction.addpostclose('inhibitposttransaction', inhibitposttransaction) return transaction @@ -190,9 +200,10 @@ This will trickle down to other part of mercurial (hidden, log, etc)""" obs = obsfunc(repo) - getrev = repo.changelog.nodemap.get - for n in repo._obsinhibit: - obs.discard(getrev(n)) + if _inhibitenabled(repo): + getrev = repo.changelog.nodemap.get + for n in repo._obsinhibit: + obs.discard(getrev(n)) return obs try: extensions.find('directaccess') diff -r 3dec62fc266e -r 8f469f81129c tests/test-inhibit.t --- a/tests/test-inhibit.t Mon Aug 10 00:44:53 2015 -0700 +++ b/tests/test-inhibit.t Wed Aug 12 20:38:39 2015 -0700 @@ -763,3 +763,21 @@ adding file changes added 1 changesets with 1 changes to 1 files 2 new obsolescence markers + +Pulling from a inhibit repo to a non-inhibit repo should work + + $ cd .. + $ hg clone -q inhibit not-inhibit + $ cat >> not-inhibit/.hg/hgrc < [extensions] + > inhibit=! + > directaccess=! + > evolve=! + > EOF + $ cd not-inhibit + $ hg book -d foo + $ hg pull + pulling from $TESTTMP/inhibit + searching for changes + no changes found + adding remote bookmark foo