Bug 4001 - rebase discards graft information
Summary: rebase discards graft information
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: rebase (show other bugs)
Version: 2.6.3
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-25 10:38 UTC by Codefox
Modified: 2013-10-07 18:27 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments
Effect of a rebase operation on a grafted changeset. (29.67 KB, image/png)
2013-07-25 10:38 UTC, Codefox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Codefox 2013-07-25 10:38 UTC
Created attachment 1735 [details]
Effect of a rebase operation on a grafted changeset.

When grafting a changeset (e.g. from a named branch to another), the new changeset knows which changeset it was grafted from.

Unfortunately this information is lost if the new changeset is rebased.

How to reproduce (after enabling the rebase extension):

  cd %TEMP%
  mkdir test
  cd test
  hg init
  echo text1 > somefile
  hg add somefile
  hg commit -m "test file" somefile
  hg branch somebranch
  hg commit -m "new branch"
  echo text2 >> somefile
  hg commit -m "change in some branch" somefile
  hg update default
  hg graft 2
  hg log --rev tip --debug

This shows something similar to this (some fields omitted):

  changeset:   3:e100db7a7f25234bfeb8e78edc571b7437694c79
  parent:      0:8a3c90ce971b3318317f24cc115f5733a04f522c
  files:       somefile
  extra:       branch=default
  extra:       source=5051d1927bce4629c9a7fea4110ec8cc61a27d8c
  description: change in some branch

Now continue and finally rebase the grafted changeset:

  hg update 0
  echo text3 >> otherfile
  hg add otherfile
  hg commit -m "foreign change" otherfile
  hg rebase --source 3 --dest 4
  hg log --rev tip --debug

This shows something similar to this (some fields omitted):

  changeset:   4:8ee60d2748a790be9780b55793990fff7b77c095
  parent:      3:82a50dd41605c13550eac2c93d25857b98854fd4
  files:       somefile
  extra:       branch=default
  extra:       rebase_source=944cf8d6673af965cadb6a851e589097921e06be
  description: change in some branch

The information from which original changeset the grafted was created from is lost. This makes it difficult at a later time to understand if a specific changeset was already grafted or not.

I have attached a screenshot from TortoiseHg that shows the revision graph before and after the rebase operation. The dotted line in the upper graph indicates a graft relationship which is lost during a rebase operation.
Comment 1 HG Bot 2013-10-02 14:30 UTC
Fixed by http://selenic.com/repo/hg/rev/a69a77a80900
Augie Fackler <raf@durin42.com>
rebase: preserve metadata from grafts of changes (issue4001)

(please test the fix)
Comment 2 Codefox 2013-10-04 03:41 UTC
I have repeated the steps and now the final log looks like this (some fields omitted):

changeset:   4:0c0ad6a81b3bfed56015c821208689d6d20eb6da
parent:      3:41b128c2f2c34040a6e0da687d9bd1461edef338
files:       somefile
extra:       branch=default
extra:       rebase_source=7f171f46e1bd9526309165a712ae89e35cf41508
extra:       source=609bafd6cb0864ca288044d6492c80e47ccdefce
description: change in some branch

Thank you very much, great job!