mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
testlib: adds drawdag support
Summary: Adds a drawdag function for easily creating a repository. Differential Revision: D35683763 fbshipit-source-id: 23d9faa28b4519b13bca07a029169043bc84eece
This commit is contained in:
parent
d3df270dff
commit
51a527b7b3
@ -27,6 +27,7 @@ class BaseTest(unittest.TestCase):
|
||||
f.write(
|
||||
f"""
|
||||
[commitcloud]
|
||||
enablestatus = False
|
||||
hostname = testhost
|
||||
remotebookmarkssync = True
|
||||
servicetype = local
|
||||
|
@ -71,3 +71,6 @@ class Repo:
|
||||
remote, name = name.split("/", 1)
|
||||
bookmarks[name] = Commit(self, entry["node"])
|
||||
return bookmarks
|
||||
|
||||
def drawdag(self, text: str) -> None:
|
||||
self.hg.debugdrawdag(stdin=text)
|
||||
|
@ -99,6 +99,29 @@ class TestLibTests(BaseTest):
|
||||
wc.hg.bookmark("foo")
|
||||
self.assertEqual(repo.bookmarks()["foo"], commit)
|
||||
|
||||
@hgtest
|
||||
def test_drawdag(self, repo: Repo, wc: WorkingCopy) -> None:
|
||||
repo.drawdag(
|
||||
"""
|
||||
C
|
||||
|
|
||||
B
|
||||
|
|
||||
A
|
||||
"""
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
repo.hg.smartlog(template="{desc}").stdout,
|
||||
"""o C
|
||||
│
|
||||
o B
|
||||
│
|
||||
o A
|
||||
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import unittest
|
||||
|
Loading…
Reference in New Issue
Block a user