Mercurial > python-hglib
view tests/test_heads.py @ 227:484b56ac4aec default tip
hglib: cat accepts a template argument
author | Julien Cristau <jcristau@mozilla.com> |
---|---|
date | Mon, 17 Jun 2024 17:17:58 +0200 |
parents | fba806958dba |
children |
line wrap: on
line source
from tests import common from hglib.util import b import subprocess class test_heads(common.basetest): def test_empty(self): self.assertEqual(self.client.heads(), []) def test_basic(self): self.append('a', 'a') rev, node0 = self.client.commit(b('first'), addremove=True) self.assertEqual(self.client.heads(), [self.client.tip()]) self.client.branch(b('foo')) self.append('a', 'a') rev, node1 = self.client.commit(b('second')) self.assertEqual(self.client.heads(node0, topological=True), []) def test_null_byte(self): self.append('a', 'a') with open('commitmessagenullbyte', 'w') as f: f.write('some message\0more stuff') # use 'hg' directly here as hglib doesn't allow # committing null byte descriptions subprocess.check_call(["hg", "commit", "-l", "commitmessagenullbyte", "--addremove", "-q"]) revs = self.client.heads() self.assertEqual(revs[0].desc, b('some message\0more stuff'))