1.0 approaches

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Feb 8 20:43:12 CST 2008


On 2008-02-08 09:09, Dustin Sallings <dustin at spy.net> wrote:
> Maybe we'd want an option to transplant to strip branch info when
> rebasing.

I think this is exactly what transplant does with:

	hg up -C target-branch
	hg transplant -b branch-to-strip

In fact, one of my original "Oops!" moments when I used the -b option of
transplant was that the `branch-to-strip' branch info `disappeared', i.e.:

  $ cd /tmp
  $ hg init hgtest
  $ cd hgtest
  $ echo foo > foo
  $ hg add
  adding foo
  $ hg ci -m 'add foo'
  $ hg branch keramida
  marked working directory as branch keramida
  $ echo bar > bar
  $ hg add
  adding bar
  $ hg ci -m 'add bar'
  $ hg up -C default
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo demo > demo
  $ hg add
  adding demo
  $ hg ci -m 'add demo'

Up to this point, the repository has a `keramida' named branch, which is
visible nicely in 'glog' output:

  $ hg glog
  @  changeset:   3:567def03ad01
  |  tag:         tip
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:09 2008 +0200
  |  summary:     add bar
  |
  o  changeset:   2:65007b442b78
  |  parent:      0:79e9d9484cd2
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:39 2008 +0200
  |  summary:     add demo
  |
  | o  changeset:   1:c6a242beb6b9
  |/   branch:      keramida
  |    user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |    date:        Sat Feb 09 04:31:09 2008 +0200
  |    summary:     add bar
  |
  o  changeset:   0:79e9d9484cd2
     user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
     date:        Sat Feb 09 04:30:37 2008 +0200
     summary:     add foo

  $

Transplanting with the -b option rebases the patch from `keramida' but
not the branch info too:

  $ hg transplant -a -b keramida
  applying c6a242beb6b9
  c6a242beb6b9 transplanted to 567def03ad01
  $ hg glog
  @  changeset:   3:567def03ad01
  |  tag:         tip
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:09 2008 +0200
  |  summary:     add bar
  |
  o  changeset:   2:65007b442b78
  |  parent:      0:79e9d9484cd2
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:39 2008 +0200
  |  summary:     add demo
  |
  | o  changeset:   1:c6a242beb6b9
  |/   branch:      keramida
  |    user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |    date:        Sat Feb 09 04:31:09 2008 +0200
  |    summary:     add bar
  |
  o  changeset:   0:79e9d9484cd2
     user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
     date:        Sat Feb 09 04:30:37 2008 +0200
     summary:     add foo

  $

Then if the `keramida' branch is stripped, the named branch is gone, but
the only easy way to move the transplanted changes to a new `keramida'
branch is to qimport them into MQ, qpop them all, start a new `keramida'
branch, and qpush/qdel them again:

  $ hg up -C
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg qimport --git -r tip
  $ hg qpop
  Patch queue now empty
  $ hg branch keramida
  marked working directory as branch keramida
  $ hg qpush -a
  applying 2.diff
  Now at: 2.diff
  $ hg qdel -r qbase:qtip
  $ hg glog
  @  changeset:   2:682d740d8041
  |  branch:      keramida
  |  tag:         tip
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:09 2008 +0200
  |  summary:     add bar
  |
  o  changeset:   1:65007b442b78
  |  user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
  |  date:        Sat Feb 09 04:31:39 2008 +0200
  |  summary:     add demo
  |
  o  changeset:   0:79e9d9484cd2
     user:        Giorgos Keramidas <keramida at ceid.upatras.gr>
     date:        Sat Feb 09 04:30:37 2008 +0200
     summary:     add foo

  $

This seems to work, but one has to manually track how many changes were
originally transplanted.  It would be awesome if it was possible to
somehow keep the branch name when transplanting, but I understand this
may be a bit tricky, since it would require (even if only for a very
short period of time) to have *two* heads called `keramida' :-(

At least qimport/qpop/qpush/qdel now *preserve* timestamps, which is
admittedly quite cool :-)

- Giorgos



More information about the Mercurial mailing list