Commit 7546412d authored by Georges Racinet's avatar Georges Racinet 🎸

testhelpers: new method to generate empty commits

This is typically used with an explicit `branch` keyword argument.
parent 79131e356920
Pipeline #13075 passed with stages
in 1 minute and 41 seconds
......@@ -283,6 +283,10 @@ class LocalRepoWrapper(object):
return self.commit((rpath, ), message=message, add_remove=True,
def commit_empty(self, parent=None, **commit_opts):
return self.commit((), **commit_opts)
def update_bin(self, bin_node, **opts):
"""Update to a revision specified by its node in binary form.
......@@ -255,6 +255,21 @@ def test_remove_file(tmpdir, msg_kind):
assert not tmpdir.join('foo').exists()
def test_empty_changeset(tmpdir):
wrapper = LocalRepoWrapper.init(tmpdir)
root_ctx = wrapper.write_commit('foo', content='bar')
# TODO make a final API, perhaps wrapper.make_empty_commit()
ctx = wrapper.commit_empty(branch='new', message='empty')
assert ctx.branch() == b'new'
assert ctx.description() == b'empty'
ctx = wrapper.commit_empty(branch='other', message='again',
assert ctx.branch() == b'other'
assert ctx.description() == b'again'
def test_prune_update_hidden(tmpdir):
wrapper = LocalRepoWrapper.init(tmpdir,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment