tests/test-bookmarks-rebase.t
author Jun Wu <quark@fb.com>
Fri, 07 Jul 2017 18:51:46 -0700
changeset 33332 3b7cb3d17137
parent 26614 ef1eb6df7071
child 34290 4f969b9e0cf5
permissions -rw-r--r--
rebase: use scmutil.cleanupnodes (issue5606) (BC) This patch migrates rebase to use scmutil.cleanupnodes API. It simplifies the code and makes rebase code reusable inside a transaction. This is a BC because the backup file is no longer strip-backup/*-backup.hg, but strip-backup/*-rebase.hg. The latter looks more reasonable since the directory name is "strip-backup" so there is no need to repeat "backup". I think the backup file name change is probably fine as a BC, since we have changed it before (aa4a1672583e) and didn't get complains. The end result of this series will be a much more consistent and unified backup names: command | old backup file suffix | new backup file suffix ------------------------------------------------------------------- amend | amend-backup.hg | amend.hg histedit | backup.hg (could be 2 files) | histedit.hg (single file) rebase | backup.hg | rebase.hg strip | backup.hg | backup.hg (note: backup files are under .hg/strip-backup) It also fixes issue5606 as a side effect because the new "delayedstrip" code path will carefully examine nodes (safestriproots) to make sure orphaned changesets won't get stripped by accident. Some warning messages are changed to the new "warning: orphaned descendants detected, not stripping HASHES", which provides more information about exactly what changesets are left behind. Another minor behavior change is when there is an obsoleted changeset with a successor in the destination branch, bookmarks pointing to that obsoleted changeset will not be moved. I have commented in test-rebase-obsolete.t explaining why that is more desirable.

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "rebase=" >> $HGRCPATH

initialize repository

  $ hg init

  $ echo 'a' > a
  $ hg ci -A -m "0"
  adding a

  $ echo 'b' > b
  $ hg ci -A -m "1"
  adding b

  $ hg up 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo 'c' > c
  $ hg ci -A -m "2"
  adding c
  created new head

  $ echo 'd' > d
  $ hg ci -A -m "3"
  adding d

  $ hg bookmark -r 1 one
  $ hg bookmark -r 3 two
  $ hg up -q two

bookmark list

  $ hg bookmark
     one                       1:925d80f479bb
   * two                       3:2ae46b1d99a7

rebase

  $ hg rebase -s two -d one
  rebasing 3:2ae46b1d99a7 "3" (tip two)
  saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg (glob)

  $ hg log
  changeset:   3:42e5ed2cdcf4
  bookmark:    two
  tag:         tip
  parent:      1:925d80f479bb
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     3
  
  changeset:   2:db815d6d32e6
  parent:      0:f7b1eb17ad24
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     2
  
  changeset:   1:925d80f479bb
  bookmark:    one
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     1
  
  changeset:   0:f7b1eb17ad24
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     0
  
aborted rebase should restore active bookmark.

  $ hg up 1
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  (leaving bookmark two)
  $ echo 'e' > d
  $ hg ci -A -m "4"
  adding d
  created new head
  $ hg bookmark three
  $ hg rebase -s three -d two
  rebasing 4:dd7c838e8362 "4" (tip three)
  merging d
  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
  unresolved conflicts (see hg resolve, then hg rebase --continue)
  [1]
  $ hg rebase --abort
  rebase aborted
  $ hg bookmark
     one                       1:925d80f479bb
   * three                     4:dd7c838e8362
     two                       3:42e5ed2cdcf4

after aborted rebase, restoring a bookmark that has been removed should not fail

  $ hg rebase -s three -d two
  rebasing 4:dd7c838e8362 "4" (tip three)
  merging d
  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
  unresolved conflicts (see hg resolve, then hg rebase --continue)
  [1]
  $ hg bookmark -d three
  $ hg rebase --abort
  rebase aborted
  $ hg bookmark
     one                       1:925d80f479bb
     two                       3:42e5ed2cdcf4