зеркало из https://github.com/mozilla/bugbug.git
Support getting revisions before a given revision
This commit is contained in:
Родитель
aebbdb9e43
Коммит
785aeca537
|
@ -342,15 +342,15 @@ def _hg_log(revs):
|
|||
return hg_log(thread_local.hg, revs)
|
||||
|
||||
|
||||
def get_revs(hg, rev_start=0):
|
||||
print(f"Getting revs from {rev_start} to tip...")
|
||||
def get_revs(hg, rev_start=0, rev_end="tip"):
|
||||
print(f"Getting revs from {rev_start} to {rev_end}...")
|
||||
|
||||
args = hglib.util.cmdbuilder(
|
||||
b"log",
|
||||
template="{node}\n",
|
||||
no_merges=True,
|
||||
branch="central",
|
||||
rev=f"{rev_start}:tip",
|
||||
rev=f"{rev_start}:{rev_end}",
|
||||
)
|
||||
x = hg.rawcommand(args)
|
||||
return x.splitlines()
|
||||
|
|
|
@ -107,6 +107,17 @@ def test_get_revs(fake_hg_repo):
|
|||
assert revs[0].decode("ascii") == revision2
|
||||
assert revs[1].decode("ascii") == revision3
|
||||
|
||||
add_file(hg, local, "file4", "1\n2\n3\n4\n5\n6\n7\n")
|
||||
commit(hg)
|
||||
|
||||
revs = repository.get_revs(hg, revision2, revision3)
|
||||
|
||||
assert (
|
||||
len(revs) == 2
|
||||
), "There should be two revision after the first and up to the third"
|
||||
assert revs[0].decode("ascii") == revision2
|
||||
assert revs[1].decode("ascii") == revision3
|
||||
|
||||
|
||||
def test_hg_log(fake_hg_repo):
|
||||
hg, local, remote = fake_hg_repo
|
||||
|
|
Загрузка…
Ссылка в новой задаче