[PATCH 5 of 5] test-context: add test for performing a diff on a memctx

Sean Farley sean.michael.farley at gmail.com
Fri Jun 13 18:56:06 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1402700358 25200
#      Fri Jun 13 15:59:18 2014 -0700
# Node ID 5f7374fd04954f47b938195d618514ca9d65597f
# Parent  9bb33f5b140fac3fbc4d97c18f7c17d36835ef15
test-context: add test for performing a diff on a memctx

We now see the first result of all that refactoring of memctx: we can now diff
against a memctx.

diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -39,10 +39,14 @@ def getfilectx(repo, memctx, f):
     if f == 'foo':
         data += 'bar\n'
     return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags)
 
 ctxa = repo.changectx(0)
-ctxb = context.memctx(repo, [ctxa.node(), None],
-                      "test diff",
-                      ["foo"], getfilectx)
+ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
+                      getfilectx, ctxa.user(), ctxa.date())
 
 print ctxb.status(ctxa)
+
+# test performing a diff on a memctx
+
+for d in ctxb.diff(ctxa, git=True):
+    print d
diff --git a/tests/test-context.py.out b/tests/test-context.py.out
--- a/tests/test-context.py.out
+++ b/tests/test-context.py.out
@@ -1,5 +1,13 @@
 workingfilectx.date = (1000, 0)
 ASCII   : Gr?ezi!
 Latin-1 : Grüezi!
 UTF-8   : Grüezi!
 (['foo'], [], [], [], [], [], [])
+diff --git a/foo b/foo
+
+--- a/foo
++++ b/foo
+@@ -1,1 +1,2 @@
+ foo
++bar
+


More information about the Mercurial-devel mailing list