D2597: graft: add test for reading old graftstate files with new mechanism

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri May 25 06:14:50 EDT 2018

pulkit added inline comments.


> martinvonz wrote in test-graft.t:1417
> Can this line be replaced by `hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate` and remove the need for the extension above (and the need to create conflicting changes)?

That's a nice idea. I think we can, but the behavior will be bit different since graft will think the working directory now contains changes from `rev 1` and will straight away try to create a commit and later reporting that graft of 1 created no changes to commit. Here is the diff:

  ~/repo/hg-committed/tests$ hg diff
  diff --git a/tests/test-graft.t b/tests/test-graft.t
  --- a/tests/test-graft.t
  +++ b/tests/test-graft.t
  @@ -1414,16 +1414,9 @@ Testing the reading of old format grafts
     $ hg add b
     $ hg ci -m "bar to b"
     created new head
  -  $ hg oldgraft -r 1 -r 2 --config extensions.oldgraft=$TESTTMP/oldgraft.py
  -  merging b
  -  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
  -  abort: unresolved conflicts
  -  [255]
  +  $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
  -  $ echo foo > b
  -  $ hg resolve -m
  -  (no more unresolved files)
  -  continue: hg graft --continue
     $ hg graft --continue
     grafting 1:80e6d2c47cfe "added b"
  +  note: graft of 1:80e6d2c47cfe created no changes to commit
     grafting 2:8be98ac1a569 "added c"

Since we are just testing reading old state format files, we should be fine with this. What do you think?

  rHG Mercurial


To: pulkit, #hg-reviewers
Cc: martinvonz, durin42, mercurial-devel

More information about the Mercurial-devel mailing list