Mercurial > python-hglib
view tests/test_diff.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 | a2afbf236ca8 |
children |
line wrap: on
line source
from tests import common from hglib.util import b class test_diff(common.basetest): def test_basic(self): self.append('a', 'a\n') self.client.add(b('a')) diff1 = b("""diff -r 000000000000 a --- /dev/null +++ b/a @@ -0,0 +1,1 @@ +a """) self.assertEqual(diff1, self.client.diff(nodates=True)) self.assertEqual(diff1, self.client.diff([b('a')], nodates=True)) rev0, node0 = self.client.commit(b('first')) diff2 = b("""diff -r 000000000000 -r """) + node0[:12] + b(""" a --- /dev/null +++ b/a @@ -0,0 +1,1 @@ +a """) self.assertEqual(diff2, self.client.diff(change=rev0, nodates=True)) self.append('a', 'a\n') rev1, node1 = self.client.commit(b('second')) diff3 = b("""diff -r """) + node0[:12] + b(""" a --- a/a +++ b/a @@ -1,1 +1,2 @@ a +a """) self.assertEqual(diff3, self.client.diff(revs=[rev0], nodates=True)) diff4 = b("""diff -r """) + node0[:12] + b(" -r ") + node1[:12] + b( """ a --- a/a +++ b/a @@ -1,1 +1,2 @@ a +a """) self.assertEqual(diff4, self.client.diff(revs=[rev0, rev1], nodates=True)) def test_basic_plain(self): with open('.hg/hgrc', 'a') as f: f.write('[defaults]\ndiff=--git\n') self.test_basic()