inhibit: update existing code to work with the rewritten version

Summary:
debuginhibit was removed since we no longer have a separate inhibit state.

smartlog hack about changing "o" to "x" was removed since "obsolete()"
revset is correct and the hack is unnecessary now.

directaccess was removed from tests since inhibit does not depend on it.

`- obsolete()` was added to some revsets to avoid divergence and other
surprises.

Use `inhibit.revive` API in infinitepush and reset to revive changesets
properly.

Remove various hacky code that mangle inhibit state in corner cases.

Most test changes are `o` changed to `x` in output since we draw
`obsolete()` state correctly now. `test-infinitepush-backup-remotefilelog.t`
change was because output could be `bytes/sec` instead of `KB/sec`.

Test Plan: arc unit

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: kulshrax, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5391361

Signature: t1:5391361:1499722618:d3c1cf629f0c59ecdf1dfd5e653c1eb6176646b8
This commit is contained in:
Jun Wu 2017-07-10 15:45:31 -07:00
parent 40503c20fb
commit 99386e40fd
32 changed files with 96 additions and 481 deletions

View File

@ -1,146 +0,0 @@
# debuginhibit.py
#
# Copyright 2017 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""debug commands and instrumentation for the inhibit extension
Adds the `debuginhibit` and `debugdeinhibit` commands to manually inhibit
and deinhibit nodes for testing purposes. Also causes inhibit to print
out the nodes being inhihibited or deinhibited and/or a stack trace of each
call site with the following config options::
[debuginhibit]
printnodes = true
printstack = true
stackdepth = 4
If stackdepth is not specified, a full stack trace will be printed.
"""
import inspect
import os
from functools import partial
from operator import itemgetter
from mercurial import (
cmdutil,
extensions,
error,
registrar,
scmutil,
)
from mercurial.i18n import _
from mercurial.node import short
testedwith = 'ships-with-fb-hgext'
cmdtable = {}
command = registrar.command(cmdtable)
inhibit = None
def extsetup(ui):
global inhibit
try:
inhibit = extensions.find('inhibit')
except KeyError:
ui.debug("no inhibit extension detected - "
"disabling debuginhibit\n")
return
if ui.configbool('debuginhibit', 'printnodes'):
extensions.wrapfunction(
inhibit,
'_inhibitmarkers',
partial(printnodeswrapper, ui, label="Inhibiting")
)
extensions.wrapfunction(
inhibit,
'_deinhibitmarkers',
partial(printnodeswrapper, ui, label="Deinhibiting")
)
def printnodeswrapper(ui, orig, repo, nodes, label=None):
"""Wrapper function that prints the nodes being inhibited/dehinhibited."""
if label is None:
label = "Nodes"
# `nodes` may be a generator, so collect it into a list first.
nodes = list(nodes)
ui.status(_("%s: %s\n") % (label, [short(n) for n in nodes]))
# Print out a truncated stack trace at the callsite if specified.
if ui.configbool('debuginhibit', 'printstack'):
trace = [_printframe(fi) for fi in inspect.stack()]
# Truncate the stack trace is specified by the user's config.
# Always remove the first two entries since they correspond
# to this wrapper function.
depth = ui.config('debuginhibit', 'stackdepth')
trace = trace[2:] if depth is None else trace[2:2 + int(depth)]
ui.status(_("Context:\n\t%s\n") % "\n\t".join(trace))
return orig(repo, nodes)
@command('debuginhibit', [
('r', 'rev', [], _("revisions to inhibit or deinhibit")),
('d', 'deinhibit', False, _("deinhibit the specified revs"))
])
def debuginhibit(ui, repo, *revs, **opts):
"""manually inhibit or deinhibit the specified revisions
By default inhibits any obsolescence markers on the given revs.
With no arguments prints out a list of inhibited nodes.
"""
_checkenabled(repo)
revs = list(revs) + opts.get('rev', [])
# If no arguments were passed to the command, just print out all the
# inhibited nodes and exit.
if not revs:
_prettyprintnodes(ui, repo, repo._obsinhibit)
return
revs = scmutil.revrange(repo, revs)
nodes = (repo.changelog.node(rev) for rev in revs)
with repo.wlock():
with repo.lock():
with repo.transaction('debuginhibit') as tr:
if opts.get('deinhibit', False):
inhibit._deinhibitmarkers(repo, nodes)
else:
inhibit._inhibitmarkers(repo, nodes)
# Disable inhibit's post-transaction callback so that we only
# affect the changesets specified by the user.
del tr._postclosecallback['inhibitposttransaction']
def _prettyprintnodes(ui, repo, nodes):
"""Pretty print a list of nodes."""
contexts = [repo[node] for node in nodes]
showopts = {
'template': '{rev}:{node} {if(bookmarks, "({bookmarks}) ")}'
'{desc|firstline}\n'
}
displayer = cmdutil.show_changeset(ui, repo, showopts)
for ctx in contexts:
displayer.show(ctx)
def _printframe(frameinfo):
"""Return a human-readable string representation of a FrameInfo object."""
path, line, fn = itemgetter(1, 2, 3)(frameinfo)
return "[%s:%d] %s()" % (os.path.basename(path), line, fn)
def _checkenabled(repo):
"""Abort if inhibit is unavailable or disabled."""
if inhibit is None:
raise error.Abort(_("no inhibit extension detected"))
if not inhibit._inhibitenabled(repo):
raise error.Abort(_("inhibit extension is present but disabled"))

View File

@ -53,7 +53,6 @@ from mercurial import (
phases,
registrar,
repair,
util,
)
from mercurial.node import hex
from mercurial import lock as lockmod
@ -94,7 +93,6 @@ amendopts = [
def uisetup(ui):
prune.uisetup(ui)
common.detectinhibit()
entry = extensions.wrapcommand(commands.table, 'commit', commit)
for opt in amendopts:
opt = (opt[0], opt[1], opt[2], "(with --amend) " + opt[3])
@ -317,12 +315,6 @@ def fixupamend(ui, repo):
except error.InterventionRequired:
tr.close()
raise
# There's a subtly to rebase transaction close where the rebasestate
# file will be written to disk, even if it had already been unlinked
# by the rebase logic (because the file generator was already on the
# transaction). Until we fix it in core, let's manually unlink the
# rebasestate so the rebase isn't left pending.
util.unlinkpath(repo.vfs.join("rebasestate"), ignoremissing=True)
return
preamendname = _preamendname(repo, current.node())
@ -358,9 +350,6 @@ def fixupamend(ui, repo):
repo._bookmarks.recordchange(tr)
if obsolete.isenabled(repo, obsolete.createmarkersopt):
# clean up the original node if inhibit kept it alive
if not old.obsolete():
obsolete.createmarkers(repo, [(old,())])
tr.close()
else:
tr.close()
@ -403,24 +392,6 @@ def wraprebase(orig, ui, repo, **opts):
return restack.restack(ui, repo, opts)
# We need to create a transaction to ensure that the inhibit extension's
# post-transaction hook is called after the rebase is finished. This hook
# is responsible for inhibiting visible obsolete (suspended) changesets,
# which may be created if the rebased commits have descendants that were
# not rebased. To be less invasive, create a short transaction after the
# rebase call instead of wrapping the call itself in a transaction.
with repo.wlock():
with repo.lock():
ret = orig(ui, repo, **opts)
with repo.transaction('rebase'):
# The rebase command will cause the rebased commits to still be
# cached as 'visible', even if the entire stack has been
# rebased and everything is obsolete. We need to manaully clear
# the cached values to that the post-transaction callback will
# work correctly.
repo.invalidatevolatilesets()
return ret
return orig(ui, repo, **opts)
def _preamendname(repo, node):

View File

@ -21,20 +21,6 @@ from mercurial import (
from mercurial.i18n import _
from mercurial.node import nullrev
inhibitmod = None
def detectinhibit():
global inhibitmod
try:
inhibitmod = extensions.find('inhibit')
except KeyError:
pass
def deinhibit(repo, contexts):
"""Remove any inhibit markers on the given change contexts."""
if inhibitmod:
inhibitmod._deinhibitmarkers(repo, (ctx.node() for ctx in contexts))
def getchildrelationships(repo, revs):
"""Build a defaultdict of child relationships between all descendants of
revs. This information will prevent us from having to repeatedly
@ -48,20 +34,18 @@ def getchildrelationships(repo, revs):
children[parent].add(rev)
return children
def restackonce(ui, repo, rev, rebaseopts=None, childrenonly=False,
inhibithack=False):
def restackonce(ui, repo, rev, rebaseopts=None, childrenonly=False):
"""Rebase all descendants of precursors of rev onto rev, thereby
stabilzing any non-obsolete descendants of those precursors.
Takes in an optional dict of options for the rebase command.
If childrenonly is True, only rebases direct children of precursors
of rev rather than all descendants of those precursors.
inhibithack: temporarily, make deinhibit override inhibit transaction
handling. useful to make things obsoleted inside a transaction.
"""
# Get visible descendants of precusors of rev.
# Excluding obsoleted changesets avoids divergence issues.
allprecursors = repo.revs('allprecursors(%d)', rev)
fmt = '%s(%%ld) - %%ld' % ('children' if childrenonly else 'descendants')
fmt = ('%s(%%ld) - %%ld - obsolete()'
% ('children' if childrenonly else 'descendants'))
descendants = repo.revs(fmt, allprecursors, allprecursors)
# Nothing to do if there are no descendants.
@ -90,39 +74,8 @@ def restackonce(ui, repo, rev, rebaseopts=None, childrenonly=False,
# Perform rebase.
with repo.ui.configoverride(overrides, 'restack'):
# hack: make rebase obsolete commits
if inhibithack and inhibitmod:
inhibitmod.deinhibittransaction = True
rebase.rebase(ui, repo, **rebaseopts)
# Remove any preamend bookmarks on precursors.
_clearpreamend(repo, allprecursors)
# Deinhibit the precursors so that they will be correctly shown as
# obsolete. Also deinhibit their ancestors to handle the situation
# where restackonce() is being used across several transactions
# (such as calls to `hg next --rebase`), because each transaction
# close will result in the ancestors being re-inhibited if they have
# unrebased (and therefore unstable) descendants. As such, the final
# call to restackonce() at the top of the stack should deinhibit the
# entire stack.
ancestors = repo.set('%ld %% %d', allprecursors, rev)
deinhibit(repo, ancestors)
if inhibithack and inhibitmod:
inhibitmod.deinhibittransaction = False
def _clearpreamend(repo, revs):
"""Remove any preamend bookmarks on the given revisions."""
# Use unfiltered repo in case the given revs are hidden. This should
# ordinarily never happen due to the inhibit extension but it's better
# to be resilient to this case.
repo = repo.unfiltered()
cl = repo.changelog
for rev in revs:
for bookmark in repo.nodebookmarks(cl.node(rev)):
if bookmark.endswith('.preamend'):
repo._bookmarks.pop(bookmark, None)
def latest(repo, rev):
"""Find the "latest version" of the given revision -- either the
latest visible successor, or the revision itself if it has no

View File

@ -131,8 +131,6 @@ def fold(ui, repo, *revs, **opts):
commitopts['message'] = "\n".join(msgs)
commitopts['edit'] = True
if common.inhibitmod:
common.inhibitmod.deinhibittransaction = True
newid, unusedvariable = common.rewrite(repo, root, allctx, head,
[root.p1().node(),
root.p2().node()],
@ -148,10 +146,7 @@ def fold(ui, repo, *revs, **opts):
if torebase:
folded = repo.revs('allsuccessors(%ld)', revs).last()
common.restackonce(ui, repo, folded, inhibithack=True)
if common.inhibitmod:
common.inhibitmod.deinhibittransaction = False
common.restackonce(ui, repo, folded)
tr.close()
finally:
@ -159,9 +154,6 @@ def fold(ui, repo, *revs, **opts):
finally:
lockmod.release(lock, wlock)
# clean up possibly incorrect rebasestate
repo.vfs.tryunlink('rebasestate')
def _foldcheck(repo, revs):
roots = repo.revs('roots(%ld)', revs)
if len(roots) > 1:

View File

@ -143,17 +143,6 @@ def _moverelative(ui, repo, args, opts, reverse=False):
if not noactivate and not movebookmark:
_activate(ui, repo, target)
# Clear cached 'visible' set so that the post-transaction hook
# set by the inhibit extension will see a correct view of
# the repository. The cached contents of the visible set are
# after a rebase operation show the old stack as visible,
# which will cause the inhibit extension to always inhibit
# the stack even if it is entirely obsolete and hidden.
repo.invalidatevolatilesets()
# The rebasestate file is incorrectly left behind, so cleanup.
# See the earlier comment on util.unlinkpath for more details.
repo.vfs.tryunlink('rebasestate')
def _findtarget(ui, repo, n, opts, reverse):
"""Find the appropriate target changeset for `hg previous` and
`hg next` based on the provided options. May rebase the traversed

View File

@ -60,17 +60,6 @@ def restack(ui, repo, rebaseopts=None):
if successor is not None:
commands.update(ui, repo, rev=successor)
# Clear cached 'visible' set so that the post-transaction
# hook in the inhibit extension will see a correct view of
# the repository. The cached contents of the visible set are
# after a rebase operation show the old stack as visible,
# which will cause the inhibit extension to always inhibit
# the stack even if it is entirely obsolete.
repo.invalidatevolatilesets()
# The rebasestate file is incorrectly left behind, so cleanup.
# See the earlier comment on util.unlinkpath for more details.
repo.vfs.tryunlink("rebasestate")
def _findrestacktargets(repo, base):
"""Starting from the given base revision, do a BFS forwards through
history, looking for changesets with unstable descendants on their

View File

@ -115,10 +115,7 @@ def split(ui, repo, *revs, **opts):
if torebase:
top = repo.revs('allsuccessors(%d)', rev).last()
common.restackonce(ui, repo, top, inhibithack=True)
common.restackonce(ui, repo, top)
tr.close()
finally:
lockmod.release(tr, lock, wlock)
# clean up possibly incorrect rebasestate
repo.vfs.tryunlink('rebasestate')

View File

@ -33,7 +33,7 @@ def unamend(ui, repo, **opts):
`hg amend` (e.g. files modified as part of an amend will be
marked as modified `hg status`)"""
try:
inhibitmod = extensions.find('inhibit')
extensions.find('inhibit')
except KeyError:
hint = _("please add inhibit to the list of enabled extensions")
e = _("unamend requires inhibit extension to be enabled")
@ -60,8 +60,6 @@ def unamend(ui, repo, **opts):
with repo.lock():
repobookmarks = repo._bookmarks
ctxbookmarks = curctx.bookmarks()
# we want to inhibit markers that mark precnode obsolete
inhibitmod._inhibitmarkers(unfi, [precnode])
changedfiles = []
wctx = repo[None]
wm = wctx.manifest()
@ -83,7 +81,5 @@ def unamend(ui, repo, **opts):
for book in ctxbookmarks:
repobookmarks[book] = precnode
repobookmarks.recordchange(tr)
obsolete.createmarkers(repo, [(curctx, (precctx,))])
tr.close()
# we want to mark the changeset from which we were unamending
# as obsolete
obsolete.createmarkers(repo, [(curctx, ())])

View File

@ -47,55 +47,17 @@ def _pull(orig, ui, repo, *args, **opts):
# Try to find match with the drafts
tocreate = []
unfiltered = repo.unfiltered()
for rev in unfiltered.revs("draft() - hidden()"):
for rev in unfiltered.revs("draft() - obsolete()"):
n = unfiltered[rev]
diff = getdiff(n)
if diff in landeddiffs:
if diff in landeddiffs and landeddiffs[diff].rev() != n.rev():
tocreate.append((n, (landeddiffs[diff],)))
if not tocreate:
return r
inhibit, deinhibitnodes = _deinhibitancestors(unfiltered, tocreate)
with unfiltered.lock():
with unfiltered.transaction('pullcreatemarkers'):
obsolete.createmarkers(unfiltered, tocreate)
if deinhibitnodes:
inhibit._deinhibitmarkers(unfiltered, deinhibitnodes)
return r
def _deinhibitancestors(repo, markers):
"""Compute the set of commits that already have obsolescence markers
which were possibly inhibited, and should be deinhibited because of this
new pull operation.
Returns a tuple of (inhibit module, node set).
Returns (None, None) if the inhibit extension is not enabled."""
try:
inhibit = extensions.find('inhibit')
except KeyError:
return None, None
if not inhibit._inhibitenabled(repo):
return None, None
# Commits for which we should deinhibit obsolescence markers
deinhibitset = set()
# Commits whose parents we should process
toprocess = set([ctx for ctx, successor in markers])
# Commits that are already in toprocess or have already been processed
seen = toprocess.copy()
# Commits that we deinhibit obsolescence markers for
while toprocess:
ctx = toprocess.pop()
for p in ctx.parents():
if p in seen:
continue
seen.add(p)
if p.obsolete():
deinhibitset.add(p.node())
toprocess.add(p)
return inhibit, deinhibitset

View File

@ -21,7 +21,6 @@ from mercurial import (
from mercurial import pycompat, scmutil
from hgext import blackbox
from hgext3rd import (
debuginhibit,
smartlog,
sparse,
)
@ -219,8 +218,6 @@ def rage(ui, repo, *pats, **opts):
'--getinfo', check=False))),
('hg debugobsolete <smartlog>',
_failsafe(lambda: obsoleteinfo(repo, hgcmd))),
('hg debuginhibit',
_failsafe(lambda: hgcmd(debuginhibit.debuginhibit))),
('hg config (all)', _failsafe(lambda: hgcmd(commands.config))),
]

View File

@ -71,16 +71,22 @@ def _revive(repo, rev):
"""Brings the given rev back into the repository. Finding it in backup
bundles if necessary.
"""
if _isahash(rev):
# If it appears to be a hash, just read it directly.
try:
rev = scmutil.revsingle(repo, rev).node()
return repo[rev]
except error.FilteredRepoLookupError:
return _touch(repo, repo.unfiltered()[rev])
except error.RepoLookupError:
# It could either be a revset or a stripped commit.
pass
unfi = repo.unfiltered()
try:
ctx = unfi[rev]
except error.RepoLookupError:
# It could either be a revset or a stripped commit.
pass
else:
if ctx.obsolete():
try:
inhibit = extensions.find('inhibit')
except KeyError:
raise error.Abort(_('cannot revive %s - inhibit extension '
'is not enabled') % ctx)
else:
torevive = unfi.set('::%d & obsolete()', ctx.rev())
inhibit.revive(torevive, operation='reset')
try:
revs = scmutil.revrange(repo, [rev])
@ -93,12 +99,6 @@ def _revive(repo, rev):
return _pullbundle(repo, rev)
def _touch(repo, rev):
"""Touch the given rev and any of its ancestors to bring it back into the
repository.
"""
raise error.Abort("unable to revive '%s' - feature not implemented yet")
def _pullbundle(repo, rev):
"""Find the given rev in a backup bundle and pull it back into the
repository.

View File

@ -161,8 +161,6 @@ def uisetup(ui):
revset.symbols['smartlog'] = smartlogrevset
revset.safesymbols.add('smartlog')
extensions.wrapfunction(templatekw, 'showgraphnode', showgraphnode)
templatekeyword = registrar.templatekeyword()
@templatekeyword('singlepublicsuccessor')
@ -212,16 +210,6 @@ def histeditsuccessors(repo, ctx, **args):
asnodes = list(modifysuccessors(ctx, 'histedit'))
return templatekw.showlist('histeditsuccessor', asnodes, args)
def showgraphnode(orig, repo, ctx, **args):
"""Show obsolete nodes as 'x', even when inhibited."""
char = orig(repo, ctx, **args)
if char != 'o' or ctx.node() == '...':
return char
try:
return 'x' if repo.revs('allsuccessors(%d)', ctx.rev()) else char
except error.UnknownIdentifier:
return char
def successormarkers(ctx):
for data in ctx.repo().obsstore.successors.get(ctx.node(), ()):
yield obsutil.marker(ctx.repo(), data)

View File

@ -660,7 +660,7 @@ def _pull(orig, ui, repo, source="default", **opts):
repo[rev]
except error.FilteredRepoLookupError:
node = unfi[rev].node()
inhibitmod._inhibitmarkers(repo.unfiltered(), [node])
inhibitmod.revive([repo.unfiltered()[node]])
except error.RepoLookupError:
pass

View File

@ -1,51 +0,0 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> debuginhibit=$TESTDIR/../hgext3rd/debuginhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> [debuginhibit]
> printnodes = true
> printstack = true
> stackdepth = 1
> [experimental]
> evolution = createmarkers
> EOF
$ showgraph() {
> hg log --graph -T "{rev}:{node|short} {desc|firstline}"
> }
Test manually inhibiting and deinhibiting nodes.
$ hg init allowunstable && cd allowunstable
$ hg debugbuilddag "+3 *3"
$ showgraph
o 3:6100d3090acf r3
|
| o 2:01241442b3c2 r2
| |
| o 1:66f7d451a68b r1
|/
o 0:1ea73414a91b r0
$ hg debugobsolete 66f7d451a68b85ed82ff5fcc254daf50c74144bd 6100d3090acf50ed11ec23196cec20f5bd7323aa --config "debuginhibit.printstack=false"
Inhibiting: ['66f7d451a68b']
$ hg log -r 'unstable()'
$ hg debuginhibit
1:66f7d451a68b85ed82ff5fcc254daf50c74144bd r1
$ hg debuginhibit -d 1
Deinhibiting: ['66f7d451a68b']
Context:
[debuginhibit.py:*] debuginhibit() (glob)
$ hg log -r 'unstable()'
changeset: 2:01241442b3c2
user: debugbuilddag
date: Thu Jan 01 00:00:02 1970 +0000
trouble: unstable
summary: r2
$ hg debuginhibit
$ hg debuginhibit 1
Inhibiting: ['66f7d451a68b']
Context:
[debuginhibit.py:*] debuginhibit() (glob)

View File

@ -1,7 +1,6 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
@ -206,25 +205,6 @@ Test --no-rebase flag.
|/
o 0 r0
Test case in which inhibit fails to inhibit the working copy parent, but
does inhibit its descendants in the old stack. The fold command should
manually inhibit any visible obsolete commits in the old stack.
$ hg up 7
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg fold --from 8
2 changesets folded
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ showgraph
@ 10 r4
|
| o 9 r1
| |
+---o 7 r4
| |
o | 6 r1
|/
o 0 r0
Test that bookmarks are correctly moved.
$ reset
$ hg debugbuilddag +3

View File

@ -1,7 +1,6 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=

View File

@ -1,10 +1,11 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
> [fbamend]
> userestack=True
> [experimental]
> evolution = createmarkers, allowunstable
> EOF
@ -51,9 +52,9 @@ Rebasing single changeset.
|
| o 3 r3
| |
| o 2 r2
| x 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -109,11 +110,11 @@ Rebasing a stack one changeset at a time.
|
| o 4 r4
| |
| o 3 r3
| x 3 r3
| |
| o 2 r2
| x 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -158,11 +159,11 @@ Rebasing a stack two changesets at a time.
| |
| o 4 r4
| |
| o 3 r3
| x 3 r3
| |
| o 2 r2
| x 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -204,7 +205,7 @@ Rebasing after multiple amends.
| |
| o 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -245,7 +246,7 @@ Rebasing from below the amended changeset with the --newest flag.
| |
| o 3 r3
| |
| o 2 r2
| x 2 r2
|/
o 1 r1
|
@ -297,7 +298,7 @@ rolled back and the final state should be as it was before `hg next --rebase`.
| |
| o 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -324,7 +325,7 @@ rolled back and the final state should be as it was before `hg next --rebase`.
| |
| o 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
@ -349,7 +350,7 @@ Test a situation where there is a conflict.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
@ -366,7 +367,7 @@ Test a situation where there is a conflict.
| |
| @ 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
@ -390,9 +391,9 @@ Now resolve the conflict and resume the rebase.
|
| o 3 add d
| |
| o 2 add c
| x 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a

View File

@ -1,7 +1,6 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=

View File

@ -1,10 +1,7 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> debuginhibit=$TESTDIR/../hgext3rd/debuginhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
> [experimental]
> evolution = createmarkers, allowunstable
@ -24,13 +21,9 @@ Test that rebased commits that would cause instability are inhibited.
| o 1 r1
|/
o 0 r0
$ hg rebase -r 1 -d 3 --config "debuginhibit.printnodes=true"
$ hg rebase -r 1 -d 3
rebasing 1:* "r1" (glob)
merging mf
Inhibiting: ['*'] (glob)
Deinhibiting: ['*'] (glob)
Deinhibiting: []
Inhibiting: ['*'] (glob)
$ showgraph
o 4 r1
|
@ -38,8 +31,6 @@ Test that rebased commits that would cause instability are inhibited.
|
| o 2 r2
| |
| o 1 r1
| x 1 r1
|/
o 0 r0
Make sure there are no unstable commits.
$ hg log -r 'unstable()'

View File

@ -1,12 +1,15 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
> [experimental]
> evolution = createmarkers
> allowdivergence = True
> evolution = createmarkers, allowunstable
> [fbamend]
> # do not write preamend bookmarks
> userestack = True
> EOF
$ mkcommit() {
> echo "$1" > "$1"
@ -67,7 +70,7 @@ Test basic case of a single amend in a small stack.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -107,7 +110,7 @@ Test multiple amends of same commit.
|
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -142,7 +145,7 @@ Test conflict during rebasing.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -173,8 +176,6 @@ Test conflict during rebasing.
|
@ 6 add b
|
| o 1 add b
|/
o 0 add a
Test finding a stable base commit from within the old stack.
@ -198,7 +199,7 @@ Test finding a stable base commit from within the old stack.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -235,7 +236,7 @@ Test finding a stable base commit from a new child of the amended commit.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -280,13 +281,13 @@ a commit on top of one of the obsolete intermediate commits.
|
| @ 6 add e
| |
| o 5 add b
| x 5 add b
|/
| o 3 add d
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -333,9 +334,9 @@ behavior is now incorrect -- restack should always fix the whole stack.)
| |
| | @ 3 add d
| | |
+---o 2 add c
+---x 2 add c
| |
o | 1 add b
x | 1 add b
|/
o 0 add a
$ hg rebase --restack
@ -379,7 +380,7 @@ below the current commit alone.
| |
| | o 4 add e
| | |
| | o 3 add d
| | x 3 add d
| |/
| o 2 add c
| |
@ -490,12 +491,30 @@ since the successor is obsolete.
$ hg amend
warning: the changeset's children were left behind
(use 'hg restack' to rebase them)
$ showgraph
@ 4 add b
|
| o 2 add c
| |
| x 1 add b
|/
o 0 add a
$ hg up 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo c >> b
$ hg amend
warning: the changeset's children were left behind
(use 'hg restack' to rebase them)
$ showgraph
@ 6 add b
|
| o 4 add b
|/
| o 2 add c
| |
| x 1 add b
|/
o 0 add a
$ hg unamend
$ hg up -C 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@ -515,6 +534,8 @@ since the successor is obsolete.
|
@ 4 add b
|
| o 1 add b
|/
o 0 add a
Test recursive restacking -- basic case.
@ -544,7 +565,7 @@ Test recursive restacking -- basic case.
| |
| | o 3 add d
| | |
+---o 2 add c
+---x 2 add c
| |
@ | 1 add b
|/
@ -609,7 +630,7 @@ stack is lost upon rebasing lower levels.
|
| o 13 add h
| |
| o 12 add g
| x 12 add g
|/
o 11 add c
|
@ -617,13 +638,13 @@ stack is lost upon rebasing lower levels.
| |
| | o 7 add f
| | |
| | o 6 add e
| | x 6 add e
| |/
| o 5 add b
| |
| | o 3 add d
| | |
+---o 2 add c
+---x 2 add c
| |
@ | 1 add b
|/

View File

@ -1,7 +1,6 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
@ -230,7 +229,7 @@ Split using revset.
o 10 add d1 and d2
|
o 0 add a1 and a2
x 0 add a1 and a2
Test that command aborts when given multiple commits.
$ hg split 11 12
@ -267,7 +266,7 @@ Test --no-rebase flag.
o 10 add d1 and d2
|
o 0 add a1 and a2
x 0 add a1 and a2
$ hg split --no-rebase << EOF
> y
> y
@ -305,7 +304,7 @@ Test --no-rebase flag.
| |
| o 25 add c1 and c2
| |
| o 24 add e1 and e2
| x 24 add e1 and e2
|/
o 19 add b1 and b2
|
@ -317,7 +316,7 @@ Test --no-rebase flag.
o 10 add d1 and d2
|
o 0 add a1 and a2
x 0 add a1 and a2
Test that bookmarks are correctly moved.
$ reset

View File

@ -1,7 +1,6 @@
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
@ -50,7 +49,7 @@ Test hg amend --fixup.
| |
| o 2 add c
| |
| o 1 add b
| x 1 add b
|/
o 0 add a

View File

@ -591,7 +591,6 @@ Make sure that unamend works as expected with inhibit
$ cat >> .hg/hgrc <<EOF
> [extensions]
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> EOF
$ hg unamend

View File

@ -11,7 +11,6 @@ Setup
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> rebase=
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbhistedit=$TESTDIR/../hgext3rd/fbhistedit.py
> [experimental]
> evolution = createmarkers

View File

@ -39,7 +39,7 @@ Pull changes client-side
pulling from ssh://user@dummy/repo
streaming all changes
5 files to transfer, 1.06 KB of data
transferred 1.06 KB in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
transferred 1.06 KB in [\d.]+ seconds \([\d.]+ .*\) (re)
searching for changes
no changes found
@ -95,7 +95,7 @@ Now try to restore it from different client. Make sure bookmark
$ hgcloneshallow ssh://user@dummy/repo secondclient
streaming all changes
2 files to transfer, 268 bytes of data
transferred 268 bytes in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
transferred 268 bytes in [\d.]+ seconds \([\d.]+ .*\) (re)
searching for changes
no changes found
updating to branch default

View File

@ -416,7 +416,6 @@ Push to svn server should fail
Scratch pull of pruned commits
$ cat >> .hg/hgrc << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> [experimental]

View File

@ -15,7 +15,6 @@ Test that hg pull creates obsolescence markers for landed diffs
> rebaseskipobsolete=True
> [extensions]
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> strip=
> rebase=
@ -122,10 +121,10 @@ hide them since there is a non-hidden successor.
| o 4 "add d
| |
| | Differential Revision: https://phabricator.fb.com/D131"
| o 3 "add c
| x 3 "add c
| |
| | Differential Revision: https://phabricator.fb.com/D124"
| o 2 "add b
| x 2 "add b
|/
| Differential Revision: https://phabricator.fb.com/D123"
@ 1 "add secondcommit"

View File

@ -15,7 +15,6 @@ Test that hg pull creates obsolescence markers for landed diffs
> rebaseskipobsolete=True
> [extensions]
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> strip=
> rebase=

View File

@ -180,7 +180,7 @@ Reset touches commits to revive, when inhibit is not enabled it creates
a new hash for them (not working for now - blocked by hash-preserving obsstore)
$ hg reset -C 7f3a02b3e388
abort: unable to revive '%s' - feature not implemented yet
abort: cannot revive 7f3a02b3e388 - inhibit extension is not enabled
[255]
$ hg log -r 7f3a02b3e388
abort: hidden revision '7f3a02b3e388'!
@ -195,12 +195,10 @@ Reset + Inhibit tests, with inhibit reset revives the same commit
> [extensions]
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> rebase=
> EOF
$ hg reset -C 7f3a02b3e388
Warning: accessing hidden changesets 7f3a02b3e388 for write operation
$ hg log -G -T '{node|short} {bookmarks}\n'
@ 7f3a02b3e388 foo
|

View File

@ -1,9 +1,7 @@
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> inhibit=$TESTDIR/../hgext3rd/inhibit.py
> rebase=
> smartlog=$TESTDIR/../hgext3rd/smartlog.py
> [experimental]
> evolution = createmarkers

View File

@ -1,6 +1,5 @@
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> fbamend=$TESTDIR/../hgext3rd/fbamend
> histedit=
> inhibit=$TESTDIR/../hgext3rd/inhibit.py

View File

@ -484,7 +484,6 @@ and allowance of prune rebases
> [extensions]
> strip=
> fbamend=$TESTDIR/../hgext3rd/fbamend
> directaccess=$TESTDIR/../hgext3rd/directaccess.py
> EOF
$ echo root > root && hg ci -Am root # rev 0
adding root