hg rebase around moved files (and reverse rebase)

Jan Heylen heyleke at gmail.com
Tue Aug 16 16:36:25 UTC 2016


Hi,

I've got a use case where I'm not sure it's Mercurial not supporting
it, or I'm doing something wrong:

given following changesets:
@  changeset:   4:d1bdc2a34719
|  tag:         tip
|  parent:      2:e58e6d5376b9
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:31:01 2016 +0200
|  summary:     something
|
|  diff --git a/src/a b/src/a
|  --- a/src/a
|  +++ b/src/a
|  @@ -0,0 +1,1 @@
|  +something
|
| o  changeset:   3:0b12071a20eb
|/   user:        Jan Heylen <jan.heylen at nokia.com>
|    date:        Tue Aug 16 18:30:09 2016 +0200
|    summary:     move to files
|
|    diff --git a/src/a b/files/a
|    rename from src/a
|    rename to files/a
|    diff --git a/src/b b/files/b
|    rename from src/b
|    rename to files/b
|    diff --git a/src/c b/files/c
|    rename from src/c
|    rename to files/c
|
o  changeset:   2:e58e6d5376b9
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:28:45 2016 +0200
|  summary:     c
|
|  diff --git a/src/c b/src/c
|  new file mode 100644
|
o  changeset:   1:d367a00baf35
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:28:41 2016 +0200
|  summary:     b
|
|  diff --git a/src/b b/src/b
|  new file mode 100644
|
o  changeset:   0:4a6db5e97373
   user:        Jan Heylen <jan.heylen at nokia.com>
   date:        Tue Aug 16 18:28:36 2016 +0200
   summary:     a

   diff --git a/src/a b/src/a
   new file mode 100644


Now, if I rebase '4' on top of '3', hg rebase understands the file
move and applies the changeset properly:
rebasing 4:d1bdc2a34719 "something" (tip)
Updating from rev. 'd1bdc2a34719 tip' to rev. '0b12071a20eb'
Updating from rev. '0b12071a20eb' to rev. '0b12071a20eb' (merge with
rev. 'd1bdc2a34719')
merging files/a and src/a to files/a
saved backup bundle to
/home/jheylen/src/file_move2/.hg/strip-backup/d1bdc2a34719-66d6def9-backup.hg
First new changeset: a10b8486328eb05f3ada43861580de7b33667db9

after rebase:
@  changeset:   4:a10b8486328e
|  tag:         tip
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:31:01 2016 +0200
|  summary:     something
|
|  diff --git a/files/a b/files/a
|  --- a/files/a
|  +++ b/files/a
|  @@ -0,0 +1,1 @@
|  +something
|
o  changeset:   3:0b12071a20eb
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:30:09 2016 +0200
|  summary:     move to files
|
|  diff --git a/src/a b/files/a
|  rename from src/a
|  rename to files/a
|  diff --git a/src/b b/files/b
|  rename from src/b
|  rename to files/b
|  diff --git a/src/c b/files/c
|  rename from src/c
|  rename to files/c
|
o  changeset:   2:e58e6d5376b9
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:28:45 2016 +0200
|  summary:     c
|
|  diff --git a/src/c b/src/c
|  new file mode 100644
|
o  changeset:   1:d367a00baf35
|  user:        Jan Heylen <jan.heylen at nokia.com>
|  date:        Tue Aug 16 18:28:41 2016 +0200
|  summary:     b
|
|  diff --git a/src/b b/src/b
|  new file mode 100644
|
o  changeset:   0:4a6db5e97373
   user:        Jan Heylen <jan.heylen at nokia.com>
   date:        Tue Aug 16 18:28:36 2016 +0200
   summary:     a

   diff --git a/src/a b/src/a
   new file mode 100644


when I now do the opposite and I rebase 4' back to dest '2', hg rebase
fails: it doesn't understand the reverse 'file move':

rebasing 4:a10b8486328e "something" (tip)
Updating from rev. 'a10b8486328e tip' to rev. 'e58e6d5376b9'
Updating from rev. 'e58e6d5376b9' to rev. 'e58e6d5376b9' (merge with
rev. 'a10b8486328e')
remote changed files/a which local deleted
use (c)hanged version, leave (d)eleted, or leave (u)nresolved?


Is this expected behaviour and/or is there a way to do this properly?


fyi, I'm using mercurial version 3.7.3

br,

Jan


More information about the Mercurial mailing list