Mercurial > evolve
changeset 1819:642f86363883 mercurial-3.6
merge with mercurial-3.7
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 28 Feb 2017 17:15:21 +0100 |
parents | f23df9d65565 (current diff) acfc610ec304 (diff) |
children | 056c8052884d d4e7d8392cfa |
files | hgext/directaccess.py hgext/inhibit.py tests/test-evolve-topic.t tests/test-inhibit.t |
diffstat | 9 files changed, 20 insertions(+), 1666 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/directaccess.py Tue Feb 28 17:11:51 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -""" This extension provides direct access -It is the ability to refer and access hidden sha in commands provided that you -know their value. -For example hg log -r xxx where xxx is a commit has should work whether xxx is -hidden or not as we assume that the user knows what he is doing when referring -to xxx. -""" -from mercurial import extensions -from mercurial import cmdutil -from mercurial import repoview -from mercurial import branchmap -from mercurial import revset -from mercurial import error -from mercurial import commands -from mercurial import hg -from mercurial import util -from mercurial.i18n import _ - -cmdtable = {} -command = cmdutil.command(cmdtable) - -# By default, all the commands have directaccess with warnings -# List of commands that have no directaccess and directaccess with no warning -directaccesslevel = [ - # Format: - # ('nowarning', 'evolve', 'prune'), - # means: no directaccess warning, for the command in evolve named prune - # - # ('error', None, 'serve'), - # means: no directaccess for the command in core named serve - # - # The list is ordered alphabetically by command names, starting with all - # the commands in core then all the commands in the extensions - # - # The general guideline is: - # - remove directaccess warnings for read only commands - # - no direct access for commands with consequences outside of the repo - # - leave directaccess warnings for all the other commands - # - ('nowarning', None, 'annotate'), - ('nowarning', None, 'archive'), - ('nowarning', None, 'bisect'), - ('nowarning', None, 'bookmarks'), - ('nowarning', None, 'bundle'), - ('nowarning', None, 'cat'), - ('nowarning', None, 'diff'), - ('nowarning', None, 'export'), - ('nowarning', None, 'identify'), - ('nowarning', None, 'incoming'), - ('nowarning', None, 'log'), - ('nowarning', None, 'manifest'), - ('error', None, 'outgoing'), # confusing if push errors and not outgoing - ('error', None, 'push'), # destructive - ('nowarning', None, 'revert'), - ('error', None, 'serve'), - ('nowarning', None, 'tags'), - ('nowarning', None, 'unbundle'), - ('nowarning', None, 'update'), -] - -def reposetup(ui, repo): - repo._explicitaccess = set() - -def _computehidden(repo): - hidden = repoview.filterrevs(repo, 'visible') - cl = repo.changelog - dynamic = hidden & repo._explicitaccess - if dynamic: - blocked = cl.ancestors(dynamic, inclusive=True) - hidden = frozenset(r for r in hidden if r not in blocked) - return hidden - -def setupdirectaccess(): - """ Add two new filtername that behave like visible to provide direct access - and direct access with warning. Wraps the commands to setup direct access - """ - repoview.filtertable.update({'visible-directaccess-nowarn': _computehidden}) - repoview.filtertable.update({'visible-directaccess-warn': _computehidden}) - branchmap.subsettable['visible-directaccess-nowarn'] = 'visible' - branchmap.subsettable['visible-directaccess-warn'] = 'visible' - - for warn, ext, cmd in directaccesslevel: - try: - cmdtable = extensions.find(ext).cmdtable if ext else commands.table - wrapper = wrapwitherror if warn == 'error' else wrapwithoutwarning - extensions.wrapcommand(cmdtable, cmd, wrapper) - except (error.UnknownCommand, KeyError): - pass - -def wrapwitherror(orig, ui, repo, *args, **kwargs): - if repo and repo.filtername == 'visible-directaccess-warn': - repo = repo.filtered('visible') - return orig(ui, repo, *args, **kwargs) - -def wrapwithoutwarning(orig, ui, repo, *args, **kwargs): - if repo and repo.filtername == 'visible-directaccess-warn': - repo = repo.filtered("visible-directaccess-nowarn") - return orig(ui, repo, *args, **kwargs) - -def uisetup(ui): - """ Change ordering of extensions to ensure that directaccess extsetup comes - after the one of the extensions in the loadsafter list """ - loadsafter = ui.configlist('directaccess','loadsafter') - order = list(extensions._order) - directaccesidx = order.index('directaccess') - - # The min idx for directaccess to load after all the extensions in loadafter - minidxdirectaccess = directaccesidx - - for ext in loadsafter: - try: - minidxdirectaccess = max(minidxdirectaccess, order.index(ext)) - except ValueError: - pass # extension not loaded - - if minidxdirectaccess > directaccesidx: - order.insert(minidxdirectaccess + 1, 'directaccess') - order.remove('directaccess') - extensions._order = order - -def _repository(orig, *args, **kwargs): - """Make visible-directaccess-warn the default filter for new repos""" - repo = orig(*args, **kwargs) - return repo.filtered("visible-directaccess-warn") - -def extsetup(ui): - extensions.wrapfunction(revset, 'posttreebuilthook', _posttreebuilthook) - extensions.wrapfunction(hg, 'repository', _repository) - setupdirectaccess() - -hashre = util.re.compile('[0-9a-fA-F]{1,40}') - -_listtuple = ('symbol', '_list') - -def _ishashsymbol(symbol, maxrev): - # Returns true if symbol looks like a hash - try: - n = int(symbol) - if n <= maxrev: - # It's a rev number - return False - except ValueError: - pass - return hashre.match(symbol) - -def gethashsymbols(tree, maxrev): - # Returns the list of symbols of the tree that look like hashes - # for example for the revset 3::abe3ff it will return ('abe3ff') - if not tree: - return [] - - results = [] - if len(tree) == 2 and tree[0] == "symbol": - results.append(tree[1]) - elif tree[0] == "func" and tree[1] == _listtuple: - # the optimiser will group sequence of hash request - results += tree[2][1].split('\0') - elif len(tree) >= 3: - for subtree in tree[1:]: - results += gethashsymbols(subtree, maxrev) - # return directly, we don't need to filter symbols again - return results - return [s for s in results if _ishashsymbol(s, maxrev)] - -def _posttreebuilthook(orig, tree, repo): - # This is use to enabled direct hash access - # We extract the symbols that look like hashes and add them to the - # explicitaccess set - orig(tree, repo) - filternm = "" - if repo is not None: - filternm = repo.filtername - if filternm is not None and filternm.startswith('visible-directaccess'): - prelength = len(repo._explicitaccess) - accessbefore = set(repo._explicitaccess) - cl = repo.unfiltered().changelog - repo.symbols = gethashsymbols(tree, len(cl)) - for node in repo.symbols: - try: - node = cl._partialmatch(node) - except error.LookupError: - node = None - if node is not None: - rev = cl.rev(node) - if rev not in repo.changelog: - repo._explicitaccess.add(rev) - if prelength != len(repo._explicitaccess): - if repo.filtername != 'visible-directaccess-nowarn': - unhiddencommits = repo._explicitaccess - accessbefore - repo.ui.warn(_("Warning: accessing hidden changesets %s " - "for write operation\n") % - (",".join([str(repo.unfiltered()[l]) - for l in unhiddencommits]))) - repo.invalidatevolatilesets()
--- a/hgext/inhibit.py Tue Feb 28 17:11:51 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -"""reduce the changesets evolution feature scope for early and noob friendly ui - -the full scale changeset evolution have some massive bleeding edge and it is -very easy for people not very intimate with the concept to end up in intricate -situation. in order to get some of the benefit sooner, this extension is -disabling some of the less polished aspect of evolution. it should gradually -get thinner and thinner as changeset evolution will get more polished. this -extension is only recommended for large scale organisations. individual user -should probably stick on using evolution in its current state, understand its -concept and provide feedback - -This extension provides the ability to "inhibit" obsolescence markers. obsolete -revision can be cheaply brought back to life that way. -However as the inhibitor are not fitting in an append only model, this is -incompatible with sharing mutable history. -""" -from mercurial import localrepo -from mercurial import obsolete -from mercurial import extensions -from mercurial import cmdutil -from mercurial import error -from mercurial import scmutil -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__): - - @localrepo.storecache('obsinhibit') - def _obsinhibit(self): - # XXX we should make sure it is invalidated by transaction failure - obsinhibit = set() - raw = self.svfs.tryread('obsinhibit') - for i in xrange(0, len(raw), 20): - obsinhibit.add(raw[i:i + 20]) - return obsinhibit - - def commit(self, *args, **kwargs): - newnode = super(obsinhibitedrepo, self).commit(*args, **kwargs) - if newnode is not None: - _inhibitmarkers(repo, [newnode]) - return newnode - - repo.__class__ = obsinhibitedrepo - -def _update(orig, ui, repo, *args, **kwargs): - """ - When moving to a commit we want to inhibit any obsolete commit affecting - the changeset we are updating to. In other words we don't want any visible - commit to be obsolete. - """ - wlock = None - try: - # Evolve is running a hook on lock release to display a warning message - # if the workind dir's parent is obsolete. - # We take the lock here to make sure that we inhibit the parent before - # that hook get a chance to run. - wlock = repo.wlock() - res = orig(ui, repo, *args, **kwargs) - newhead = repo['.'].node() - _inhibitmarkers(repo, [newhead]) - return res - finally: - lockmod.release(wlock) - -def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs): - """ Add inhibition markers to every obsolete bookmarks """ - repo = bkmstoreinst._repo - bkmstorenodes = [repo[v].node() for v in bkmstoreinst.values()] - _inhibitmarkers(repo, bkmstorenodes) - return orig(bkmstoreinst, *args, **kwargs) - -def _bookmark(orig, ui, repo, *bookmarks, **opts): - """ Add a -D option to the bookmark command, map it to prune -B """ - haspruneopt = opts.get('prune', False) - if not haspruneopt: - return orig(ui, repo, *bookmarks, **opts) - elif opts.get('rename'): - raise error.Abort('Cannot use both -m and -D') - elif len(bookmarks) == 0: - hint = _('make sure to put a space between -D and your bookmark name') - raise error.Abort(_('Error, please check your command'), hint=hint) - - # Call prune -B - evolve = extensions.find('evolve') - optsdict = { - 'new': [], - 'succ': [], - 'rev': [], - 'bookmark': bookmarks, - 'keep': None, - 'biject': False, - } - evolve.cmdprune(ui, repo, **optsdict) - -# obsolescence inhibitor -######################## - -def _schedulewrite(tr, obsinhibit): - """Make sure on disk content will be updated on transaction commit""" - def writer(fp): - """Serialize the inhibited list to disk. - """ - raw = ''.join(obsinhibit) - fp.write(raw) - tr.addfilegenerator('obsinhibit', ('obsinhibit',), writer) - tr.hookargs['obs_inbihited'] = '1' - -def _filterpublic(repo, nodes): - """filter out inhibitor on public changeset - - Public changesets are already immune to obsolescence""" - getrev = repo.changelog.nodemap.get - getphase = repo._phasecache.phase - return (n for n in nodes - if getrev(n) is not None and getphase(repo, getrev(n))) - -def _inhibitmarkers(repo, nodes): - """add marker inhibitor for all obsolete revision under <nodes> - - Content of <nodes> and all mutable ancestors are considered. Marker for - obsolete revision only are created. - """ - if not _inhibitenabled(repo): - return - - # we add (non public()) as a lower boundary to - # - use the C code in 3.6 (no ancestors in C as this is written) - # - restrict the search space. Otherwise, the ancestors can spend a lot of - # time iterating if you have a check very low in the repo. We do not need - # to iterate over tens of thousand of public revisions with higher - # revision number - # - # In addition, the revset logic could be made significantly smarter here. - newinhibit = repo.revs('(not public())::%ln and obsolete()', nodes) - if newinhibit: - node = repo.changelog.node - lock = tr = None - try: - lock = repo.lock() - tr = repo.transaction('obsinhibit') - repo._obsinhibit.update(node(r) for r in newinhibit) - _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) - repo.invalidatevolatilesets() - tr.close() - finally: - lockmod.release(tr, lock) - -def _deinhibitmarkers(repo, nodes): - """lift obsolescence inhibition on a set of nodes - - 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') - try: - repo._obsinhibit -= deinhibited - _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) - repo.invalidatevolatilesets() - tr.close() - finally: - tr.release() - -def _createmarkers(orig, repo, relations, flag=0, date=None, metadata=None): - """wrap markers create to make sure we de-inhibit target nodes""" - # wrapping transactio to unify the one in each function - lock = tr = None - try: - lock = repo.lock() - tr = repo.transaction('add-obsolescence-marker') - orig(repo, relations, flag, date, metadata) - precs = (r[0].node() for r in relations) - _deinhibitmarkers(repo, precs) - tr.close() - finally: - lockmod.release(tr, lock) - -def _filterobsoleterevswrap(orig, repo, rebasesetrevs, *args, **kwargs): - repo._notinhibited = rebasesetrevs - try: - repo.invalidatevolatilesets() - r = orig(repo, rebasesetrevs, *args, **kwargs) - finally: - del repo._notinhibited - repo.invalidatevolatilesets() - return r - -def transactioncallback(orig, repo, desc, *args, **kwargs): - """ Wrap localrepo.transaction to inhibit new obsolete changes """ - def inhibitposttransaction(transaction): - # At the end of the transaction we catch all the new visible and - # obsolete commit to inhibit them - visibleobsolete = repo.revs('obsolete() - hidden()') - ignoreset = set(getattr(repo, '_rebaseset', [])) - ignoreset |= set(getattr(repo, '_obsoletenotrebased', [])) - visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset) - if visibleobsolete: - _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) - transaction = orig(repo, desc, *args, **kwargs) - if desc != 'strip' and _inhibitenabled(repo): - transaction.addpostclose('inhibitposttransaction', - inhibitposttransaction) - return transaction - - -# We wrap these two functions to address the following scenario: -# - Assuming that we have markers between commits in the rebase set and -# destination and that these markers are inhibited -# - At the end of the rebase the nodes are still visible because rebase operate -# without inhibition and skip these nodes -# We keep track in repo._obsoletenotrebased of the obsolete commits skipped by -# the rebase and lift the inhibition in the end of the rebase. - -def _computeobsoletenotrebased(orig, repo, *args, **kwargs): - r = orig(repo, *args, **kwargs) - repo._obsoletenotrebased = r.keys() - return r - -def _clearrebased(orig, ui, repo, *args, **kwargs): - r = orig(ui, repo, *args, **kwargs) - tonode = repo.changelog.node - if util.safehasattr(repo, '_obsoletenotrebased'): - _deinhibitmarkers(repo, [tonode(k) for k in repo._obsoletenotrebased]) - return r - - -def extsetup(ui): - # lets wrap the computation of the obsolete set - # We apply inhibition there - obsfunc = obsolete.cachefuncs['obsolete'] - def _computeobsoleteset(repo): - """remove any inhibited nodes from the obsolete set - - This will trickle down to other part of mercurial (hidden, log, etc)""" - obs = obsfunc(repo) - if _inhibitenabled(repo): - getrev = repo.changelog.nodemap.get - blacklist = getattr(repo, '_notinhibited', set()) - for n in repo._obsinhibit: - if getrev(n) not in blacklist: - obs.discard(getrev(n)) - return obs - try: - extensions.find('directaccess') - except KeyError: - errormsg = _('cannot use inhibit without the direct access extension\n') - hint = _("(please enable it or inhibit won\'t work)\n") - ui.warn(errormsg) - ui.warn(hint) - return - - # Wrapping this to inhibit obsolete revs resulting from a transaction - extensions.wrapfunction(localrepo.localrepository, - 'transaction', transactioncallback) - - obsolete.cachefuncs['obsolete'] = _computeobsoleteset - # wrap create marker to make it able to lift the inhibition - extensions.wrapfunction(obsolete, 'createmarkers', _createmarkers) - # drop divergence computation since it is incompatible with "light revive" - obsolete.cachefuncs['divergent'] = lambda repo: set() - # drop bumped computation since it is incompatible with "light revive" - obsolete.cachefuncs['bumped'] = lambda repo: set() - # wrap update to make sure that no obsolete commit is visible after an - # update - extensions.wrapcommand(commands.table, 'update', _update) - try: - rebase = extensions.find('rebase') - if rebase: - if util.safehasattr(rebase, '_filterobsoleterevs'): - extensions.wrapfunction(rebase, - '_filterobsoleterevs', - _filterobsoleterevswrap) - extensions.wrapfunction(rebase, 'clearrebased', _clearrebased) - if util.safehasattr(rebase, '_computeobsoletenotrebased'): - extensions.wrapfunction(rebase, - '_computeobsoletenotrebased', - _computeobsoletenotrebased) - - except KeyError: - pass - # There are two ways to save bookmark changes during a transation, we - # wrap both to add inhibition markers. - extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged) - if getattr(bookmarks.bmstore, 'write', None) is not None:# mercurial < 3.9 - extensions.wrapfunction(bookmarks.bmstore, 'write', _bookmarkchanged) - # Add bookmark -D option - entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark) - entry[1].append(('D','prune',None, - _('delete the bookmark and prune the commits underneath'))) - -@command('debugobsinhibit', [], '') -def cmddebugobsinhibit(ui, repo, *revs): - """inhibit obsolescence markers effect on a set of revs""" - nodes = (repo[r].node() for r in scmutil.revrange(repo, revs)) - _inhibitmarkers(repo, nodes)
--- a/tests/test-amend.t Tue Feb 28 17:11:51 2017 +0100 +++ b/tests/test-amend.t Tue Feb 28 17:15:21 2017 +0100 @@ -128,7 +128,7 @@ Commits a new changeset incorporating both the changes to the given files and all the changes from the current parent changeset into the repository. - See 'hg commit' for details about committing changes. + See "hg commit" for details about committing changes. If you don't specify -m, the parent's message will be reused. @@ -136,7 +136,7 @@ of the current parent. Then it creates a new commit on the parent's parents with the updated contents. Then it changes the working copy parent to this new combined changeset. Finally, the old changeset and its update - are hidden from 'hg log' (unless you use --hidden with log). + are hidden from "hg log" (unless you use --hidden with log). Returns 0 on success, 1 if nothing changed.
--- a/tests/test-evolve-topic.t Tue Feb 28 17:11:51 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ - -Check we can find the topic extensions - - $ [ -z "$HGTEST_TOPICROOT" ] && echo 'skipped: $HGTEST_TOPICROOT not set' >&2 && exit 80 - [1] - $ [ ! -e $HGTEST_TOPICROOT/hgext3rd/topic/__init__.py ] && echo 'skipped: no topic repo found at $HGTEST_TOPICROOT' >&2 && exit 80 - [1] - $ cat >> $HGRCPATH <<EOF - > [defaults] - > amend=-d "0 0" - > fold=-d "0 0" - > [phases] - > publish = False - > [ui] - > logtemplate = {rev} - \{{get(namespaces, "topics")}} {node|short} {desc} ({phase})\n - > [diff] - > git = 1 - > unified = 0 - > [extensions] - > rebase = - > topic = $HGTEST_TOPICROOT/hgext3rd/topic/ - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH - - $ mkcommit() { - > echo "$1" > "$1" - > hg add "$1" - > hg ci -m "add $1" - > } - -Create a simple setup - - $ hg init repoa - $ cd repoa - $ mkcommit aaa - $ mkcommit bbb - $ hg topic foo - $ mkcommit ccc - $ mkcommit ddd - $ mkcommit eee - $ mkcommit fff - $ hg topic bar - $ mkcommit ggg - $ mkcommit hhh - $ mkcommit iii - $ mkcommit jjj - - $ hg log -G - @ 9 - {bar} 1d964213b023 add jjj (draft) - | - o 8 - {bar} fcab990f3261 add iii (draft) - | - o 7 - {bar} b0c2554835ac add hhh (draft) - | - o 6 - {bar} c748293f1c1a add ggg (draft) - | - o 5 - {foo} 6a6b7365c751 add fff (draft) - | - o 4 - {foo} 3969ab847d9c add eee (draft) - | - o 3 - {foo} 4e3a154f38c7 add ddd (draft) - | - o 2 - {foo} cced9bac76e3 add ccc (draft) - | - o 1 - {} a4dbed0837ea add bbb (draft) - | - o 0 - {} 199cc73e9a0b add aaa (draft) - - -Test that evolve --all evolve the current topic ------------------------------------------------ - -make a mess - - $ hg up foo - switching to topic foo - 0 files updated, 0 files merged, 4 files removed, 0 files unresolved - $ hg topic -l - ### topic: foo (?) - ### branch: default (?) - t4@ add fff (current) - t3: add eee - t2: add ddd - t1: add ccc - ^ add bbb - $ hg up 'desc(ddd)' - 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ echo ddd >> ddd - $ hg amend - 6 new unstable changesets - $ hg up 'desc(fff)' - 3 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo fff >> fff - $ hg amend - - $ hg log -G - @ 13 - {foo} e104f49bab28 add fff (draft) - | - | o 11 - {foo} d9cacd156ffc add ddd (draft) - | | - | | o 9 - {bar} 1d964213b023 add jjj (draft) - | | | - | | o 8 - {bar} fcab990f3261 add iii (draft) - | | | - | | o 7 - {bar} b0c2554835ac add hhh (draft) - | | | - | | o 6 - {bar} c748293f1c1a add ggg (draft) - | | | - +---x 5 - {foo} 6a6b7365c751 add fff (draft) - | | - o | 4 - {foo} 3969ab847d9c add eee (draft) - | | - x | 3 - {foo} 4e3a154f38c7 add ddd (draft) - |/ - o 2 - {foo} cced9bac76e3 add ccc (draft) - | - o 1 - {} a4dbed0837ea add bbb (draft) - | - o 0 - {} 199cc73e9a0b add aaa (draft) - - -Run evolve --all - - $ hg evolve --all - move:[4] add eee - atop:[11] add ddd - move:[13] add fff - atop:[14] add eee - working directory is now at 070c5573d8f9 - $ hg log -G - @ 15 - {foo} 070c5573d8f9 add fff (draft) - | - o 14 - {foo} 42b49017ff90 add eee (draft) - | - o 11 - {foo} d9cacd156ffc add ddd (draft) - | - | o 9 - {bar} 1d964213b023 add jjj (draft) - | | - | o 8 - {bar} fcab990f3261 add iii (draft) - | | - | o 7 - {bar} b0c2554835ac add hhh (draft) - | | - | o 6 - {bar} c748293f1c1a add ggg (draft) - | | - | x 5 - {foo} 6a6b7365c751 add fff (draft) - | | - | x 4 - {foo} 3969ab847d9c add eee (draft) - | | - | x 3 - {foo} 4e3a154f38c7 add ddd (draft) - |/ - o 2 - {foo} cced9bac76e3 add ccc (draft) - | - o 1 - {} a4dbed0837ea add bbb (draft) - | - o 0 - {} 199cc73e9a0b add aaa (draft) - - -Test that evolve does not loose topic information -------------------------------------------------- - - $ hg evolve --rev 'topic(bar)' - move:[6] add ggg - atop:[15] add fff - move:[7] add hhh - atop:[16] add ggg - move:[8] add iii - atop:[17] add hhh - move:[9] add jjj - atop:[18] add iii - working directory is now at 9bf430c106b7 - $ hg log -G - @ 19 - {bar} 9bf430c106b7 add jjj (draft) - | - o 18 - {bar} d2dc89c57700 add iii (draft) - | - o 17 - {bar} 20bc4d02aa62 add hhh (draft) - | - o 16 - {bar} 16d6f664b17c add ggg (draft) - | - o 15 - {foo} 070c5573d8f9 add fff (draft) - | - o 14 - {foo} 42b49017ff90 add eee (draft) - | - o 11 - {foo} d9cacd156ffc add ddd (draft) - | - o 2 - {foo} cced9bac76e3 add ccc (draft) - | - o 1 - {} a4dbed0837ea add bbb (draft) - | - o 0 - {} 199cc73e9a0b add aaa (draft) - - -Tests next and prev behavior -============================ - -Basic move are restricted to the current topic - - $ hg up foo - switching to topic foo - 0 files updated, 0 files merged, 4 files removed, 0 files unresolved - $ hg prev - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - [14] add eee - $ hg next - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - [15] add fff - $ hg next - no children on topic "foo" - do you want --no-topic - [1] - $ hg next --no-topic - switching to topic bar - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - [16] add ggg - $ hg prev - no parent in topic "bar" - (do you want --no-topic) - $ hg prev --no-topic - switching to topic foo - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - [15] add fff
--- a/tests/test-evolve.t Tue Feb 28 17:11:51 2017 +0100 +++ b/tests/test-evolve.t Tue Feb 28 17:15:21 2017 +0100 @@ -56,7 +56,7 @@ between repositories. This allows for a safe and simple way of exchanging mutable history and altering it after the fact. Changeset phases are respected, such that only draft and secret changesets can be altered (see - 'hg help phases' for details). + "hg help phases" for details). Obsolescence is tracked using "obsolete markers", a piece of metadata tracking which changesets have been made obsolete, potential successors @@ -602,7 +602,6 @@ $ echo 3 > 1 $ hg resolve -m 1 (no more unresolved files) - continue: hg graft --continue $ hg graft --continue -O grafting 7:a5bfd90a2f29 "conflict" (tip) $ glog --hidden
--- a/tests/test-exchange-A3.t Tue Feb 28 17:11:51 2017 +0100 +++ b/tests/test-exchange-A3.t Tue Feb 28 17:15:21 2017 +0100 @@ -204,7 +204,7 @@ adding changesets adding manifests adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) + added 1 changesets with 1 changes to 2 files (+1 heads) 1 new obsolescence markers (run 'hg heads' to see heads, 'hg merge' to merge) 1 new unstable changesets
--- a/tests/test-inhibit.t Tue Feb 28 17:11:51 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,922 +0,0 @@ - $ cat >> $HGRCPATH <<EOF - > [ui] - > logtemplate = {rev}:{node|short} {desc}\n - > [experimental] - > prunestrip=True - > evolution=createmarkers - > [extensions] - > rebase= - > strip= - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH - $ echo "directaccess=$(echo $(dirname $TESTDIR))/hgext/directaccess.py" >> $HGRCPATH - $ echo "inhibit=$(echo $(dirname $TESTDIR))/hgext/inhibit.py" >> $HGRCPATH - $ mkcommit() { - > echo "$1" > "$1" - > hg add "$1" - > hg ci -m "add $1" - > } - - $ hg init inhibit - $ cd inhibit - $ mkcommit cA - $ mkcommit cB - $ mkcommit cC - $ mkcommit cD - $ hg up 'desc(cA)' - 0 files updated, 0 files merged, 3 files removed, 0 files unresolved - $ mkcommit cE - created new head - $ mkcommit cG - $ mkcommit cH - $ mkcommit cJ - $ hg log -G - @ 7:18214586bf78 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | o 3:2db36d8066ff add cD - | | - | o 2:7df62a38b9bf add cC - | | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - -plain prune - - $ hg strip 1:: - 3 changesets pruned - $ hg log -G - @ 7:18214586bf78 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg debugobsinhibit --hidden 1:: - $ hg log -G - @ 7:18214586bf78 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | o 3:2db36d8066ff add cD - | | - | o 2:7df62a38b9bf add cC - | | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - $ hg strip --hidden 1:: - 3 changesets pruned - $ hg log -G - @ 7:18214586bf78 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - -after amend - - $ echo babar > cJ - $ hg commit --amend - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg debugobsinhibit --hidden 18214586bf78 - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - -and no divergence - - $ hg summary - parent: 9:55c73a90e4b4 tip - add cJ - branch: default - commit: (clean) - update: 1 new changesets, 2 branch heads (merge) - phases: 6 draft - -check public revision got cleared -(when adding the second inhibitor, the first one is removed because it is public) - - $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//' - 20 .hg/store/obsinhibit - $ hg strip 7 - 1 changesets pruned - $ hg debugobsinhibit --hidden 18214586bf78 - $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//' - 20 .hg/store/obsinhibit - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg phase --public 7 - $ hg strip 9 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - working directory now at cf5c4f4554ce - 1 changesets pruned - $ hg log -G - o 7:18214586bf78 add cJ - | - @ 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg debugobsinhibit --hidden 55c73a90e4b4 - $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//' - 20 .hg/store/obsinhibit - $ hg log -G - o 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - @ 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - -Update should inhibit all related unstable commits - - $ hg update 2 --hidden - 2 files updated, 0 files merged, 3 files removed, 0 files unresolved - $ hg log -G - o 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | @ 2:7df62a38b9bf add cC - | | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - - $ hg update 9 - 4 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | o 2:7df62a38b9bf add cC - | | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - $ hg strip --hidden 1:: - 3 changesets pruned - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - -Bookmark should inhibit all related unstable commits - $ hg bookmark -r 2 book1 --hidden - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | o 2:7df62a38b9bf add cC - | | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - -Removing a bookmark with bookmark -D should prune the changes underneath -that are not reachable from another bookmark or head - - $ hg bookmark -r 1 book2 - $ hg bookmark -D book1 --config experimental.evolution=createmarkers #--config to make sure prune is not registered as a command. - bookmark 'book1' deleted - 1 changesets pruned - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - | o 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - $ hg bookmark -D book2 - bookmark 'book2' deleted - 1 changesets pruned - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - -Test edge cases of bookmark -D - $ hg book -D book2 -m hello - abort: Cannot use both -m and -D - [255] - - $ hg book -Draster-fix - abort: Error, please check your command - (make sure to put a space between -D and your bookmark name) - [255] - -Test that direct access make changesets visible - - $ hg export 2db36d8066ff 02bcbc3f6e56 - # HG changeset patch - # User test - # Date 0 0 - # Thu Jan 01 00:00:00 1970 +0000 - # Node ID 2db36d8066ff50e8be3d3e6c2da1ebc0a8381d82 - # Parent 7df62a38b9bf9daf968de235043ba88a8ef43393 - add cD - - diff -r 7df62a38b9bf -r 2db36d8066ff cD - --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - +++ b/cD Thu Jan 01 00:00:00 1970 +0000 - @@ -0,0 +1,1 @@ - +cD - # HG changeset patch - # User test - # Date 0 0 - # Thu Jan 01 00:00:00 1970 +0000 - # Node ID 02bcbc3f6e56fb2928efec2c6e24472720bf5511 - # Parent 54ccbc537fc2d6845a5d61337c1cfb80d1d2815e - add cB - - diff -r 54ccbc537fc2 -r 02bcbc3f6e56 cB - --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - +++ b/cB Thu Jan 01 00:00:00 1970 +0000 - @@ -0,0 +1,1 @@ - +cB - -But only with hash - - $ hg export 2db36d8066ff:: - # HG changeset patch - # User test - # Date 0 0 - # Thu Jan 01 00:00:00 1970 +0000 - # Node ID 2db36d8066ff50e8be3d3e6c2da1ebc0a8381d82 - # Parent 7df62a38b9bf9daf968de235043ba88a8ef43393 - add cD - - diff -r 7df62a38b9bf -r 2db36d8066ff cD - --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - +++ b/cD Thu Jan 01 00:00:00 1970 +0000 - @@ -0,0 +1,1 @@ - +cD - - $ hg export 1 3 - abort: hidden revision '1'! - (use --hidden to access hidden revisions) - [255] - - -Test directaccess in a larger revset - - $ hg log -r '. + .^ + 2db36d8066ff' -T '{node|short}\n' - 55c73a90e4b4 - cf5c4f4554ce - 2db36d8066ff - -Test directaccess only takes hashes - - $ HOOKPATH=$TESTTMP/printexplicitaccess.py - $ cat >> $HOOKPATH <<EOF - > def hook(ui, repo, **kwds): - > for i in sorted(repo._explicitaccess): - > ui.write('directaccess: %s\n' % i) - > EOF - - $ hg log -r 1 -r 2 -r 2db36d8066f -T '{rev}\n' --config hooks.post-log=python:$HOOKPATH:hook - 1 - 2 - 3 - directaccess: 3 - -With severals hidden sha, rebase of one hidden stack onto another one: - $ hg update -C 0 - 0 files updated, 0 files merged, 4 files removed, 0 files unresolved - $ mkcommit cK - created new head - $ mkcommit cL - $ hg update -C 9 - 4 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg log -G - o 11:53a94305e133 add cL - | - o 10:ad78ff7d621f add cK - | - | @ 9:55c73a90e4b4 add cJ - | | - | | o 7:18214586bf78 add cJ - | |/ - | o 6:cf5c4f4554ce add cH - | | - | o 5:5419eb264a33 add cG - | | - | o 4:98065434e5c6 add cE - |/ - o 0:54ccbc537fc2 add cA - - $ hg strip --hidden 10: - 2 changesets pruned - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg rebase -s 10 -d 3 - abort: hidden revision '3'! - (use --hidden to access hidden revisions) - [255] - $ hg rebase -r ad78ff7d621f -r 53a94305e133 -d 2db36d8066ff --config experimental.rebaseskipobsolete=0 - Warning: accessing hidden changesets 2db36d8066ff for write operation - Warning: accessing hidden changesets ad78ff7d621f,53a94305e133 for write operation - rebasing 10:ad78ff7d621f "add cK" - rebasing 11:53a94305e133 "add cL" - $ hg log -G - o 13:2f7b7704d714 add cL - | - o 12:fe1634cbe235 add cK - | - | @ 9:55c73a90e4b4 add cJ - | | - | | o 7:18214586bf78 add cJ - | |/ - | o 6:cf5c4f4554ce add cH - | | - | o 5:5419eb264a33 add cG - | | - | o 4:98065434e5c6 add cE - | | - o | 3:2db36d8066ff add cD - | | - o | 2:7df62a38b9bf add cC - | | - o | 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - -Check that amending in the middle of a stack does not show obsolete revs -Since we are doing operation in the middle of the stack we cannot just -have createmarkers as we are creating instability - - $ cat >> $HGRCPATH <<EOF - > [experimental] - > evolution=all - > EOF - - $ hg strip --hidden 1:: - 5 changesets pruned - $ hg log -G - @ 9:55c73a90e4b4 add cJ - | - | o 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg up 7 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ mkcommit cL - $ mkcommit cM - $ mkcommit cN - $ hg log -G - @ 16:a438c045eb37 add cN - | - o 15:2d66e189f5b5 add cM - | - o 14:d66ccb8c5871 add cL - | - | o 9:55c73a90e4b4 add cJ - | | - o | 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg up 15 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ echo "mmm" >> cM - $ hg amend - $ hg log -G - @ 18:210589181b14 add cM - | - | o 16:a438c045eb37 add cN - | | - | o 15:2d66e189f5b5 add cM - |/ - o 14:d66ccb8c5871 add cL - | - | o 9:55c73a90e4b4 add cJ - | | - o | 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - -Check that rebasing a commit twice makes the commit visible again - - $ hg rebase -d 18 -r 16 --keep - rebasing 16:a438c045eb37 "add cN" - $ hg log -r 14:: -G - o 19:104eed5354c7 add cN - | - @ 18:210589181b14 add cM - | - | o 16:a438c045eb37 add cN - | | - | o 15:2d66e189f5b5 add cM - |/ - o 14:d66ccb8c5871 add cL - | - $ hg strip -r 210589181b14 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - working directory now at d66ccb8c5871 - 2 changesets pruned - -Using a hash prefix solely made of digits should work - $ hg update 210589181 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg rebase -d 18 -r 16 --keep - rebasing 16:a438c045eb37 "add cN" - $ hg log -r 14:: -G - o 19:104eed5354c7 add cN - | - @ 18:210589181b14 add cM - | - | o 16:a438c045eb37 add cN - | | - | o 15:2d66e189f5b5 add cM - |/ - o 14:d66ccb8c5871 add cL - | - -Test prunestrip - - $ hg book foo -r 104eed5354c7 - $ hg strip -r 210589181b14 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - working directory now at d66ccb8c5871 - 2 changesets pruned - $ hg log -r 14:: -G -T '{rev}:{node|short} {desc|firstline} {bookmarks}\n' - o 16:a438c045eb37 add cN - | - o 15:2d66e189f5b5 add cM - | - @ 14:d66ccb8c5871 add cL foo - | - -Check that --hidden used with inhibit does not hide every obsolete commit -We show the log before and after a log -G --hidden, they should be the same - $ hg log -G - o 16:a438c045eb37 add cN - | - o 15:2d66e189f5b5 add cM - | - @ 14:d66ccb8c5871 add cL - | - | o 9:55c73a90e4b4 add cJ - | | - o | 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ hg log -G --hidden - x 19:104eed5354c7 add cN - | - x 18:210589181b14 add cM - | - | x 17:b3c3274523f9 temporary amend commit for 2d66e189f5b5 - | | - | | o 16:a438c045eb37 add cN - | |/ - | o 15:2d66e189f5b5 add cM - |/ - @ 14:d66ccb8c5871 add cL - | - | x 13:2f7b7704d714 add cL - | | - | x 12:fe1634cbe235 add cK - | | - | | x 11:53a94305e133 add cL - | | | - | | x 10:ad78ff7d621f add cK - | | | - | | | o 9:55c73a90e4b4 add cJ - | | | | - +-------x 8:e84f73d9ad36 temporary amend commit for 18214586bf78 - | | | | - o-----+ 7:18214586bf78 add cJ - / / / - | | o 6:cf5c4f4554ce add cH - | | | - | | o 5:5419eb264a33 add cG - | | | - | | o 4:98065434e5c6 add cE - | |/ - x | 3:2db36d8066ff add cD - | | - x | 2:7df62a38b9bf add cC - | | - x | 1:02bcbc3f6e56 add cB - |/ - o 0:54ccbc537fc2 add cA - - - $ hg log -G - o 16:a438c045eb37 add cN - | - o 15:2d66e189f5b5 add cM - | - @ 14:d66ccb8c5871 add cL - | - | o 9:55c73a90e4b4 add cJ - | | - o | 7:18214586bf78 add cJ - |/ - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - -check that pruning and inhibited node does not confuse anything - - $ hg up --hidden 210589181b14 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg strip --bundle 210589181b14 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/inhibit/.hg/strip-backup/210589181b14-e09c7b88-backup.hg (glob) - $ hg unbundle .hg/strip-backup/210589181b14-e09c7b88-backup.hg # restore state - adding changesets - adding manifests - adding file changes - added 2 changesets with 1 changes to 2 files (+1 heads) - (run 'hg heads .' to see heads, 'hg merge' to merge) - - Only allow direct access and check that evolve works like before -(also disable evolve commands to avoid hint about using evolve) - $ cat >> $HGRCPATH <<EOF - > [extensions] - > inhibit=! - > [experimental] - > evolution=createmarkers - > EOF - - $ hg up 15 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory parent is obsolete! - $ cat >> $HGRCPATH <<EOF - > [experimental] - > evolution=all - > EOF - $ echo "CM" > cM - $ hg amend - $ hg log -G - @ 21:721c3c279519 add cM - | - | o 16:a438c045eb37 add cN - | | - | x 15:2d66e189f5b5 add cM - |/ - o 14:d66ccb8c5871 add cL - | - o 7:18214586bf78 add cJ - | - o 6:cf5c4f4554ce add cH - | - o 5:5419eb264a33 add cG - | - o 4:98065434e5c6 add cE - | - o 0:54ccbc537fc2 add cA - - $ cat >> $HGRCPATH <<EOF - > [extensions] - > EOF - $ echo "inhibit=$(echo $(dirname $TESTDIR))/hgext/inhibit.py" >> $HGRCPATH - -Empty commit - $ hg amend - nothing changed - [1] - -Check that the behavior of rebase with obsolescence markers is maintained -despite inhibit - - $ hg up a438c045eb37 - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg rebase -r 15:: -d 21 --config experimental.rebaseskipobsolete=True - note: not rebasing 15:2d66e189f5b5 "add cM", already in destination as 21:721c3c279519 "add cM" - rebasing 16:a438c045eb37 "add cN" - $ hg up -q 2d66e189f5b5 # To inhibit it as the rest of test depends on it - $ hg up -q 21 - -Directaccess should load after some extensions precised in the conf -With no extension specified: - - $ cat >$TESTTMP/test_extension.py << EOF - > from mercurial import extensions - > def uisetup(ui): - > print extensions._order - > EOF - $ cat >> $HGRCPATH << EOF - > [extensions] - > testextension=$TESTTMP/test_extension.py - > EOF - $ hg id - ['rebase', 'strip', 'evolve', 'directaccess', 'inhibit', 'testextension'] - 721c3c279519 - -With test_extension specified: - $ cat >> $HGRCPATH << EOF - > [directaccess] - > loadsafter=testextension - > EOF - $ hg id - ['rebase', 'strip', 'evolve', 'inhibit', 'testextension', 'directaccess'] - 721c3c279519 - -Inhibit should not work without directaccess - $ cat >> $HGRCPATH <<EOF - > [extensions] - > directaccess=! - > testextension=! - > EOF - $ hg up . - cannot use inhibit without the direct access extension - (please enable it or inhibit won't work) - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo "directaccess=$(echo $(dirname $TESTDIR))/hgext/directaccess.py" >> $HGRCPATH - $ cd .. - -hg push should not allow directaccess unless forced with --hidden -We copy the inhibhit repo to inhibit2 and make some changes to push to inhibit - - $ cp -r inhibit inhibit2 - $ pwd=$(pwd) - $ cd inhibit - $ mkcommit pk - created new head - $ hg id - 003a4735afde tip - $ echo "OO" > pk - $ hg amend - $ hg id - 71eb4f100663 tip - -Hidden commits cannot be pushed without --hidden - $ hg push -r 003a4735afde $pwd/inhibit2 - pushing to $TESTTMP/inhibit2 - abort: hidden revision '003a4735afde'! - (use --hidden to access hidden revisions) - [255] - -Visible commits can still be pushed - $ hg push -r 71eb4f100663 $pwd/inhibit2 - pushing to $TESTTMP/inhibit2 - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers - -Create a stack (obsolete with successor in dest) -> (not obsolete) and rebase -it. We expect to not see the stack at the end of the rebase. - $ hg log -G -r "25::" - @ 25:71eb4f100663 add pk - | - $ hg up -C 22 - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit Dk - $ hg prune 22 -s 25 - 1 changesets pruned - $ hg rebase -s 22 -d 25 --config experimental.rebaseskipobsolete=True - note: not rebasing 22:46cb6daad392 "add cN", already in destination as 25:71eb4f100663 "add pk" - rebasing 26:7ad60e760c7b "add Dk" (tip) - $ hg log -G -r "25::" - @ 27:1192fa9fbc68 add Dk - | - o 25:71eb4f100663 add pk - | - -Create a stack (obsolete with succ in dest) -> (not obsolete) -> (not obsolete). -Rebase the first two revs of the stack onto dest, we expect to see one new -revision on the destination and everything visible. - $ hg up 25 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ mkcommit Dl - created new head - $ mkcommit Dp - $ mkcommit Do - $ hg log -G -r "25::" - @ 30:b517facce1ef add Do - | - o 29:c5a47ab27c2e add Dp - | - o 28:8c1c2edbaf1b add Dl - | - | o 27:1192fa9fbc68 add Dk - |/ - o 25:71eb4f100663 add pk - | - $ hg prune 28 -s 27 - 1 changesets pruned - $ hg up 25 - 0 files updated, 0 files merged, 3 files removed, 0 files unresolved - $ hg rebase -r "28 + 29" --keep -d 27 --config experimental.rebaseskipobsolete=True - note: not rebasing 28:8c1c2edbaf1b "add Dl", already in destination as 27:1192fa9fbc68 "add Dk" - rebasing 29:c5a47ab27c2e "add Dp" - $ hg log -G -r "25::" - o 31:7d8affb1f604 add Dp - | - | o 30:b517facce1ef add Do - | | - | o 29:c5a47ab27c2e add Dp - | | - | o 28:8c1c2edbaf1b add Dl - | | - o | 27:1192fa9fbc68 add Dk - |/ - @ 25:71eb4f100663 add pk - | - -Rebase the same stack in full on the destination, we expect it to disappear -and only see the top revision added to destination. We don\'t expect 29 to be -skipped as we used --keep before. - $ hg rebase -s 28 -d 27 --config experimental.rebaseskipobsolete=True - note: not rebasing 28:8c1c2edbaf1b "add Dl", already in destination as 27:1192fa9fbc68 "add Dk" - rebasing 29:c5a47ab27c2e "add Dp" - rebasing 30:b517facce1ef "add Do" - $ hg log -G -r "25::" - o 32:1d43fff9e26f add Do - | - o 31:7d8affb1f604 add Dp - | - o 27:1192fa9fbc68 add Dk - | - @ 25:71eb4f100663 add pk - | - -Pulling from a inhibit repo to a non-inhibit repo should work - - $ cd .. - $ hg clone -q inhibit not-inhibit - $ cat >> not-inhibit/.hg/hgrc <<EOF - > [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 - -Test that bookmark -D can take multiple branch names - $ cd ../inhibit - $ hg bookmark book2 book1 book3 - $ touch foo && hg add foo && hg ci -m "add foo" - created new head - $ hg up book1 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - (activating bookmark book1) - $ hg bookmark -D book2 book3 - bookmark 'book2' deleted - bookmark 'book3' deleted - 1 changesets pruned
--- a/tests/test-unstable.t Tue Feb 28 17:11:51 2017 +0100 +++ b/tests/test-unstable.t Tue Feb 28 17:15:21 2017 +0100 @@ -100,19 +100,21 @@ o 0:b4952fcf48cf@default(draft) add base - $ hg evo --all --any --unstable - move:[3] merge - atop:[4] aprime - working directory is now at 0bf3f3a59c8c - $ hg log -G - @ 5:0bf3f3a59c8c@default(draft) merge - |\ - | o 4:47127ea62e5f@default(draft) aprime - | | - o | 2:474da87dd33b@default(draft) add _c - |/ - o 0:b4952fcf48cf@default(draft) add base - +# Unsupported before 3.7 +# +# $ hg evo --all --any --unstable +# move:[3] merge +# atop:[4] aprime +# working directory is now at 0bf3f3a59c8c +# $ hg log -G +# @ 5:0bf3f3a59c8c@default(draft) merge +# |\ +# | o 4:47127ea62e5f@default(draft) aprime +# | | +# o | 2:474da87dd33b@default(draft) add _c +# |/ +# o 0:b4952fcf48cf@default(draft) add base +# $ cd ..
--- a/tests/test-wireproto.t Tue Feb 28 17:11:51 2017 +0100 +++ b/tests/test-wireproto.t Tue Feb 28 17:15:21 2017 +0100 @@ -144,7 +144,7 @@ adding changesets adding manifests adding file changes - added 1 changesets with 0 changes to 1 files (+1 heads) + added 1 changesets with 0 changes to 3 files (+1 heads) obsmarker-exchange: 208 bytes received 1 new obsolescence markers (run 'hg heads' to see heads, 'hg merge' to merge)