commands: graft uses a transaction (issue3628)

Alexander Becher alexander.becher at rud-steuerungstechnik.de
Wed Aug 10 10:39:20 UTC 2016


Dear all,

I tried this change for issue3628:


diff -r db0095c83344 -r 7aa594597cb3 mercurial/commands.py
--- a/mercurial/commands.py     Mon Jul 18 22:22:38 2016 +0200
+++ b/mercurial/commands.py     Fri Jul 29 11:02:45 2016 +0200
@@ -4085,7 +4085,7 @@

     Returns 0 on successful completion.
     '''
-    with repo.wlock():
+    with repo.wlock(), repo.lock(), repo.transaction('graft'):
         return _dograft(ui, repo, *revs, **opts)

 def _dograft(ui, repo, *revs, **opts):


Seemed simple enough. However, this change causes test-graft.t to fail,
see below. I don't see why, it's not the first test for graft
--continue. Can anyone see the reason?

Also, do I need both repo.wlock() and repo.lock()? Without repo.lock(),
repo.transaction('graft') raises a RuntimeError('programming error:
transaction requires locking').


$ (cd tests && python run-tests.py --first test-graft.t)

--- /cygdrive/g/src/hg/tests/test-graft.t
+++ /cygdrive/g/src/hg/tests/test-graft.t.err
@@ -489,18 +489,22 @@
   continue: hg graft --continue
   $ hg graft -c
   grafting 2:5c095ad7e90f "2"
+  note: graft of 2:5c095ad7e90f created no changes to commit
   $ hg export tip --git
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
-  # Parent  ee295f490a40b97f3d18dd4c4f1c8936c233b612
-  2
-
-  diff --git a/a b/b
-  rename from a
-  rename to b
+  # Node ID ee295f490a40b97f3d18dd4c4f1c8936c233b612
+  # Parent  f67661df0c4804d301f064f332b57e7d5ddaf2be
+  10
+
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -b
+  +c

 Test simple origin(), with and without args
   $ hg log -r 'origin()'


Regards,
Alexander


More information about the Mercurial-devel mailing list