view tests/test-rebase-backup.t @ 40417:49c7b701fdc2 stable

phase: add an archived phase This phase allows for hidden changesets in the "user space". It differs from the "internal" phase which is intended for internal by-product only. There have been discussions at the 4.8 sprint to use such phase to speedup cleanup after history rewriting operation. Shipping it in the same release as the 'internal-phase' groups the associated `requires` entry. The important bit is to have support for this phase in the earliest version of mercurial possible. Adding the UI to manipulate this new phase later seems fine. The current plan for archived usage and user interface are as follow. On a repository with internal-phase on and evolution off: * history rewriting command set rewritten changeset in the archived phase. (This mean updating the cleanupnodes method). * keep `hg unbundle .hg/strip-backup/X.hg` as a way to restore changeset for now (backup bundle need to contains phase data) * [maybe] add a `hg strip --soft` advance flag (a light way to expose the feature without getting in the way of a better UI) Mercurial 4.8 freeze is too close to get the above in by then. We don't introduce a new repository `requirement` as we reuse the one introduced with the 'archived' phase during the 4.8 cycle.
author Boris Feld <boris.feld@octobus.net>
date Wed, 17 Oct 2018 14:47:01 +0200
parents 2002c193f2bc
children 6acbe86c6490
line wrap: on
line source

  $ cat << EOF >> $HGRCPATH
  > [extensions]
  > rebase=
  > EOF

==========================================
Test history-editing-backup config option |
==========================================
Test with Pre-obsmarker rebase:
1) When config option is not set:
  $ hg init repo1
  $ cd repo1
  $ echo a>a
  $ hg ci -qAma
  $ echo b>b
  $ hg ci -qAmb
  $ echo c>c
  $ hg ci -qAmc
  $ hg up 0 -q
  $ echo d>d
  $ hg ci -qAmd
  $ echo e>e
  $ hg ci -qAme
  $ hg log -GT "{rev}: {firstline(desc)}\n"
  @  4: e
  |
  o  3: d
  |
  | o  2: c
  | |
  | o  1: b
  |/
  o  0: a
  
  $ hg rebase -s 1 -d .
  rebasing 1:d2ae7f538514 "b"
  rebasing 2:177f92b77385 "c"
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/d2ae7f538514-c7ed7a78-rebase.hg
  $ hg log -GT "{rev}: {firstline(desc)}\n"
  o  4: c
  |
  o  3: b
  |
  @  2: e
  |
  o  1: d
  |
  o  0: a
  

2) When config option is set:
  $ cat << EOF >> $HGRCPATH
  > [ui]
  > history-editing-backup = False
  > EOF

  $ echo f>f
  $ hg ci -Aqmf
  $ echo g>g
  $ hg ci -Aqmg
  $ hg log -GT "{rev}: {firstline(desc)}\n"
  @  6: g
  |
  o  5: f
  |
  | o  4: c
  | |
  | o  3: b
  |/
  o  2: e
  |
  o  1: d
  |
  o  0: a
  
  $ hg rebase -s 3 -d .
  rebasing 3:05bff2a95b12 "b"
  rebasing 4:1762bde4404d "c"

  $ hg log -GT "{rev}: {firstline(desc)}\n"
  o  6: c
  |
  o  5: b
  |
  @  4: g
  |
  o  3: f
  |
  o  2: e
  |
  o  1: d
  |
  o  0: a
  
Test when rebased revisions are stripped during abort:
======================================================

  $ echo conflict > c
  $ hg ci -Am "conflict with c"
  adding c
  created new head
  $ hg log -GT "{rev}: {firstline(desc)}\n"
  @  7: conflict with c
  |
  | o  6: c
  | |
  | o  5: b
  |/
  o  4: g
  |
  o  3: f
  |
  o  2: e
  |
  o  1: d
  |
  o  0: a
  
When history-editing-backup = True:
  $ cat << EOF >> $HGRCPATH
  > [ui]
  > history-editing-backup = True
  > EOF
  $ hg rebase -s 5 -d .
  rebasing 5:1f8148a544ee "b"
  rebasing 6:f8bc7d28e573 "c"
  merging c
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
  unresolved conflicts (see hg resolve, then hg rebase --continue)
  [1]
  $ hg rebase --abort
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/818c1a43c916-2b644d96-backup.hg
  rebase aborted

When history-editing-backup = False:
  $ cat << EOF >> $HGRCPATH
  > [ui]
  > history-editing-backup = False
  > EOF
  $ hg rebase -s 5 -d .
  rebasing 5:1f8148a544ee "b"
  rebasing 6:f8bc7d28e573 "c"
  merging c
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
  unresolved conflicts (see hg resolve, then hg rebase --continue)
  [1]
  $ hg rebase --abort
  rebase aborted
  $ cd ..