Skip to content
Snippets Groups Projects
Commit 745fe315 authored by Georges Racinet's avatar Georges Racinet
Browse files

testhelpers: prune helper

with the command not taking care of iterables not necessarily
been lists and assuming it's called from the CLI, it's a real
pain without such rewrapping.
parent d8268110
No related branches found
No related tags found
No related merge requests found
......@@ -138,3 +138,15 @@
opts = dict(force=force, rev=revs)
opts.update((phn, phn == phase_name) for phn in phases.cmdphasenames)
cmdutil.findcmd('phase', commands.table)[1][0](repo.ui, repo, **opts)
def prune(self, revs, successors=(), bookmarks=()):
# the prune command expects to get all these arguments (it relies
# on the CLI defaults but doesn't have any at the function call level).
# They are unconditionally concatened to lists, hence must be lists.
# (as of Mercurial 5.3.1)
if isinstance(revs, (bytes, str)):
revs = [revs]
return self.command('prune', rev=revs,
new=[], # deprecated yet expected
successor=list(successors),
bookmark=list(bookmarks))
......@@ -150,3 +150,12 @@
wrapper.set_phase('draft', ['.'], force=True)
assert ctx.phase() == phases.draft
def test_prune(tmpdir):
wrapper = LocalRepoWrapper.init(tmpdir,
config=dict(extensions=dict(evolve='')))
wrapper.write_commit('foo', content='Foo 0')
ctx = wrapper.write_commit('foo', content='Foo 1', return_ctx=True)
wrapper.prune('.')
assert ctx.obsolete()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment