tests/test-evolve-phase-divergence.t
changeset 3617 a0e322641810
parent 3610 145dab8c60c9
child 3618 2d8e39919742
equal deleted inserted replaced
3616:f6d629514607 3617:a0e322641810
     1 ** Test for handling of phase divergent changesets by `hg evolve` **
     1 ** Test for handling of phase divergent changesets by `hg evolve` **
     2 ====================================================================
     2 ====================================================================
       
     3 
       
     4   $ cat >> $HGRCPATH <<EOF
       
     5   > [alias]
       
     6   > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
       
     7   > EOF
       
     8 
       
     9 Setting up a public repo
       
    10 ------------------------
     3 
    11 
     4   $ hg init public
    12   $ hg init public
     5   $ cd public
    13   $ cd public
     6   $ echo a > a
    14   $ echo a > a
     7   $ mkcommit() {
    15   $ mkcommit() {
    12   $ hg commit -A -m init
    20   $ hg commit -A -m init
    13   adding a
    21   adding a
    14   $ cd ..
    22   $ cd ..
    15 
    23 
    16   $ evolvepath=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/
    24   $ evolvepath=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/
       
    25 
       
    26 Setting up a private non-publishing repo
       
    27 ----------------------------------------
       
    28 
    17   $ hg clone -U public private
    29   $ hg clone -U public private
    18   $ cd private
    30   $ cd private
    19   $ cat >> .hg/hgrc <<EOF
    31   $ cat >> .hg/hgrc <<EOF
    20   > [extensions]
    32   > [extensions]
    21   > evolve = $evolvepath
    33   > evolve = $evolvepath
    24   > [phases]
    36   > [phases]
    25   > publish = false
    37   > publish = false
    26   > EOF
    38   > EOF
    27   $ cd ..
    39   $ cd ..
    28 
    40 
       
    41 Setting up couple of more instances of private repo
       
    42 ---------------------------------------------------
       
    43 
    29   $ cp -a private alice
    44   $ cp -a private alice
    30   $ cp -a private bob
    45   $ cp -a private bob
       
    46 
       
    47 Creating a phase-divergence changeset
       
    48 -------------------------------------
       
    49 
       
    50 Alice creating a draft changeset and pushing to main private repo
    31 
    51 
    32   $ cd alice
    52   $ cd alice
    33   $ hg update
    53   $ hg update
    34   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    54   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    35   $ echo a >> a
    55   $ echo a >> a
    39   searching for changes
    59   searching for changes
    40   adding changesets
    60   adding changesets
    41   adding manifests
    61   adding manifests
    42   adding file changes
    62   adding file changes
    43   added 1 changesets with 1 changes to 1 files
    63   added 1 changesets with 1 changes to 1 files
    44   $ hg log -r 'draft()'
    64   $ hg glog
    45   1:4d1169d82e47@default(draft) modify a
    65   @  1:4d1169d82e47 modify a
       
    66   |   () draft
       
    67   o  0:d3873e73d99e init
       
    68       () public
       
    69 
       
    70 Bob pulling from private repo and pushing to the main public repo making the
       
    71 changeset public
    46 
    72 
    47   $ cd ../bob
    73   $ cd ../bob
    48   $ hg pull ../private
    74   $ hg pull ../private
    49   pulling from ../private
    75   pulling from ../private
    50   searching for changes
    76   searching for changes
    52   adding manifests
    78   adding manifests
    53   adding file changes
    79   adding file changes
    54   added 1 changesets with 1 changes to 1 files
    80   added 1 changesets with 1 changes to 1 files
    55   new changesets 4d1169d82e47
    81   new changesets 4d1169d82e47
    56   (run 'hg update' to get a working copy)
    82   (run 'hg update' to get a working copy)
    57   $ hg log -r 'draft()'
    83 
    58   1:4d1169d82e47@default(draft) modify a
    84   $ hg glog
       
    85   o  1:4d1169d82e47 modify a
       
    86   |   () draft
       
    87   o  0:d3873e73d99e init
       
    88       () public
       
    89 
    59   $ hg push ../public
    90   $ hg push ../public
    60   pushing to ../public
    91   pushing to ../public
    61   searching for changes
    92   searching for changes
    62   adding changesets
    93   adding changesets
    63   adding manifests
    94   adding manifests
    64   adding file changes
    95   adding file changes
    65   added 1 changesets with 1 changes to 1 files
    96   added 1 changesets with 1 changes to 1 files
    66   $ hg log -r 'draft()'
    97 
       
    98   $ hg glog
       
    99   o  1:4d1169d82e47 modify a
       
   100   |   () public
       
   101   o  0:d3873e73d99e init
       
   102       () public
       
   103 
       
   104 *But* Alice decided to amend the changeset she had and then pulling from public
       
   105 repo creating phase-divergent changeset locally
    67 
   106 
    68   $ cd ../alice
   107   $ cd ../alice
    69   $ hg amend -m 'tweak a'
   108   $ hg amend -m 'tweak a'
    70   $ hg pull ../public
   109   $ hg pull ../public
    71   pulling from ../public
   110   pulling from ../public
    72   searching for changes
   111   searching for changes
    73   no changes found
   112   no changes found
    74   1 new phase-divergent changesets
   113   1 new phase-divergent changesets
    75 
   114 
    76   $ hg evolve -a -A --phase-divergent
   115   $ hg glog
       
   116   @  2:98bb3a6cfe1a tweak a
       
   117   |   () draft
       
   118   | o  1:4d1169d82e47 modify a
       
   119   |/    () public
       
   120   o  0:d3873e73d99e init
       
   121       () public
       
   122 
       
   123 Using evolve --list to list phase-divergent changesets
       
   124 ------------------------------------------------------
       
   125 
       
   126   $ hg evolve --list
       
   127   98bb3a6cfe1a: tweak a
       
   128     phase-divergent: 4d1169d82e47 (immutable precursor)
       
   129   
       
   130 
       
   131 Trying to see instability on public changeset
       
   132 
       
   133   $ hg evolve -r 4d1169d8 --list
       
   134   4d1169d82e47: modify a
       
   135   
       
   136 
       
   137 Understanding phasedivergence using obslog
       
   138 ------------------------------------------
       
   139 
       
   140   $ hg obslog -r . --all
       
   141   @  98bb3a6cfe1a (2) tweak a
       
   142   |
       
   143   o  4d1169d82e47 (1) modify a
       
   144        rewritten(description) as 98bb3a6cfe1a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
       
   145   
       
   146 Solving the phase divergence using evolve command
       
   147 --------------------------------------------------
       
   148 
       
   149   $ hg evolve
       
   150   nothing to evolve on current working copy parent
       
   151   (do you want to use --phase-divergent)
       
   152   [2]
       
   153 
       
   154 testing the --confirm option
       
   155   $ hg evolve --phase-divergent --confirm <<EOF
       
   156   > n
       
   157   > EOF
       
   158   recreate:[2] tweak a
       
   159   atop:[1] modify a
       
   160   perform evolve? [Ny] n
       
   161   abort: evolve aborted by user
       
   162   [255]
       
   163 
       
   164 testing the --dry-run option
       
   165 
       
   166   $ hg evolve --phase-divergent --dry-run
       
   167   recreate:[2] tweak a
       
   168   atop:[1] modify a
       
   169   hg rebase --rev 98bb3a6cfe1a --dest d3873e73d99e;
       
   170   hg update 4d1169d82e47;
       
   171   hg revert --all --rev 98bb3a6cfe1a;
       
   172   hg commit --msg "phase-divergent update to 98bb3a6cfe1a"
       
   173 
       
   174   $ hg evolve --phase-divergent
    77   recreate:[2] tweak a
   175   recreate:[2] tweak a
    78   atop:[1] modify a
   176   atop:[1] modify a
    79   computing new diff
   177   computing new diff
    80   committed as 4d1169d82e47
   178   committed as 4d1169d82e47
    81   working directory is now at 4d1169d82e47
   179   working directory is now at 4d1169d82e47
       
   180 
       
   181   $ hg glog
       
   182   @  1:4d1169d82e47 modify a
       
   183   |   () public
       
   184   o  0:d3873e73d99e init
       
   185       () public
    82 
   186 
    83 Bumped Merge changeset:
   187 Bumped Merge changeset:
    84 -----------------------
   188 -----------------------
    85 
   189 
    86 We currently cannot automatically solve bumped changeset that is the
   190 We currently cannot automatically solve bumped changeset that is the