On 24/06/17 2:35 PM, Dr. Arne Babenhauserheide wrote:
Hi Ernie,

Ernie Rael<err...@raelity.com>  writes:
I'd like to turn it into the following, with legacy is in a different directory,
and where the history of hglog looks right. This is wanted because the new
version is buggy, and it's useful to run either.

        - - - history - - - -o:legacy
       /                    /
  o...o:fork...o...o...o...o:new
Instead of "hg rebase" I tried "hg graft" with similar results
Same thing with "hg transplant" which surprised me.

Is there a way to do this and get a clean history?
How would that clean history look? If you just want them in different
folders, you could rename legacy and then simply merge tip.

hg up legacy
hg cp . new/directory
hg ci -m "move to legacy"
hg merge -r -2
hg ci -m "merge new and old"

Best wishes,
Arne

Did I run into a merge bug?

Thanks much Arne for pointing me towards merge. I put together a script to do some simple stuff to explore merge and "hg glog" history. But I ran into something that doesn't seem right. The script is at the end.

After doing

   hg up 0
   hg copy foo.txt legacy.txt
   hg ci -m 'create legacy.txt from foo.txt'

There is a file legacy.txt with contents

   This is foo.

Then do

   hg merge
   hg ci -m 'merge into legacy'

And now the file legacy.txt is changed to

   This is foo.
   More foo.

This is a bug isn't it? How can a file that does not exist in the other branch get changed by the merge? Unless, maybe, the "hg copy" is acting more like creating a hard link.

-ernie

   #!/bin/sh

   set -e

   hg init c1
   cd c1

   echo 'This is foo.' > foo.txt
   hg add foo.txt
   hg ci -m 'create foo.txt'       # rev 0

   echo 'This is bar.' > bar.txt
   hg add bar.txt
   hg ci -m 'create bar.txt'       # rev 1

   echo 'More foo.' >> foo.txt
   hg ci -m 'more foo.txt'         # rev 2

   echo 'More bar.' >> bar.txt
   hg ci -m 'more bar.txt'         # rev 3

   hg up 0
   hg copy foo.txt legacy.txt
   hg ci -m 'create legacy.txt from foo.txt'

   if true
   then
        hg merge
        hg ci -m 'merge into legacy'
   else
        hg up 3
        hg merge
        hg ci -m 'merge from legacy'
   fi



_______________________________________________
Mercurial mailing list
Mercurial@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to