tests/test-bookmarks-rebase.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 27 Oct 2020 15:33:15 -0700
changeset 45771 f90a5c211251
parent 45150 dc5e5577af39
child 45796 e9555305c5c6
permissions -rw-r--r--
rebase: change and standarize template for rebase's one-line summary This removes the default template in rebase and switches to a centrally defined template. I've simplified it a bit to avoid the conditional parenthesis. I've also added labels so the different parts can be easily colored. The template is somewhat similar to what we've used internally at Google for a few years. I'm happy to change the template if others have opinions. Should we reuse the `color.log.` names as I have? Differential Revision: https://phab.mercurial-scm.org/D9252

  $ 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 tip two "3"
  saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg

  $ 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 tip three "4"
  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 tip three "4"
  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