Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
heptapod
py-heptapod
Commits
62c5b7e44fa5
Commit
7546412d
authored
Nov 11, 2020
by
Georges Racinet
🦑
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
heptapod/testhelpers.py
heptapod/testhelpers.py
+4
-0
heptapod/tests/test_testhelpers.py
heptapod/tests/test_testhelpers.py
+15
-0
No files found.
heptapod/testhelpers.py
View file @
62c5b7e4
...
...
@@ -283,6 +283,10 @@ class LocalRepoWrapper(object):
return
self
.
commit
((
rpath
,
),
message
=
message
,
add_remove
=
True
,
**
commit_opts
)
def
commit_empty
(
self
,
parent
=
None
,
**
commit_opts
):
self
.
prepare_wdir
(
parent
=
parent
)
return
self
.
commit
((),
**
commit_opts
)
def
update_bin
(
self
,
bin_node
,
**
opts
):
"""Update to a revision specified by its node in binary form.
...
...
heptapod/tests/test_testhelpers.py
View file @
62c5b7e4
...
...
@@ -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'
,
parent
=
root_ctx
)
assert
ctx
.
branch
()
==
b
'other'
assert
ctx
.
description
()
==
b
'again'
def
test_prune_update_hidden
(
tmpdir
):
wrapper
=
LocalRepoWrapper
.
init
(
tmpdir
,
config
=
dict
(
extensions
=
dict
(
evolve
=
''
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment