tests/test-evolve-orphan-split.t
changeset 3537 8b5093f333dc
child 3541 bc47c09c9782
equal deleted inserted replaced
3536:8432bc989053 3537:8b5093f333dc
       
     1 ** Testing resolution of orphans by `hg evolve` where an obsolete changeset has
       
     2 multiple successors **
       
     3 
       
     4   $ cat >> $HGRCPATH <<EOF
       
     5   > [ui]
       
     6   > interactive = True
       
     7   > [alias]
       
     8   > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
       
     9   > [extensions]
       
    10   > rebase =
       
    11   > EOF
       
    12   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
       
    13 
       
    14 Repo Setup
       
    15 
       
    16   $ hg init repo
       
    17   $ cd repo
       
    18   $ echo ".*\.orig" > .hgignore
       
    19   $ hg add .hgignore
       
    20   $ hg ci -m "added hgignore"
       
    21 
       
    22 An orphan changeset with parent got splitted
       
    23 --------------------------------------------
       
    24 
       
    25   $ for ch in a b c; do echo foo > $ch; done;
       
    26 
       
    27   $ hg add a b
       
    28   $ hg ci -m "added a and b"
       
    29   $ hg add c
       
    30   $ hg ci -m "added c"
       
    31 
       
    32   $ hg glog
       
    33   @  2:86e1ebf1ca61 added c
       
    34   |   () draft
       
    35   o  1:d0ddb614efbd added a and b
       
    36   |   () draft
       
    37   o  0:8fa14d15e168 added hgignore
       
    38       () draft
       
    39 
       
    40   $ hg split -r 1 <<EOF
       
    41   > y
       
    42   > y
       
    43   > n
       
    44   > y
       
    45   > EOF
       
    46   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
    47   adding a
       
    48   adding b
       
    49   diff --git a/a b/a
       
    50   new file mode 100644
       
    51   examine changes to 'a'? [Ynesfdaq?] y
       
    52   
       
    53   @@ -0,0 +1,1 @@
       
    54   +foo
       
    55   record change 1/2 to 'a'? [Ynesfdaq?] y
       
    56   
       
    57   diff --git a/b b/b
       
    58   new file mode 100644
       
    59   examine changes to 'b'? [Ynesfdaq?] n
       
    60   
       
    61   created new head
       
    62   Done splitting? [yN] y
       
    63   1 new orphan changesets
       
    64 
       
    65   $ hg glog
       
    66   @  4:8b179cffc81c added a and b
       
    67   |   () draft
       
    68   o  3:bd3735d4dab0 added a and b
       
    69   |   () draft
       
    70   | *  2:86e1ebf1ca61 added c
       
    71   | |   () draft
       
    72   | x  1:d0ddb614efbd added a and b
       
    73   |/    () draft
       
    74   o  0:8fa14d15e168 added hgignore
       
    75       () draft
       
    76 
       
    77   $ hg evolve
       
    78   move:[2] added c
       
    79   atop:[4] added a and b
       
    80   working directory is now at af13f0560b31
       
    81 
       
    82   $ hg glog
       
    83   @  5:af13f0560b31 added c
       
    84   |   () draft
       
    85   o  4:8b179cffc81c added a and b
       
    86   |   () draft
       
    87   o  3:bd3735d4dab0 added a and b
       
    88   |   () draft
       
    89   o  0:8fa14d15e168 added hgignore
       
    90       () draft
       
    91 
       
    92 When the successors does not form a linear chain and are multiple heads
       
    93 -----------------------------------------------------------------------
       
    94 
       
    95   $ hg fold -r .^^::. --exact -m "added a b c"
       
    96   3 changesets folded
       
    97   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    98 
       
    99   $ hg glog
       
   100   @  6:f89e4764f2ed added a b c
       
   101   |   () draft
       
   102   o  0:8fa14d15e168 added hgignore
       
   103       () draft
       
   104   $ echo foo > d
       
   105   $ hg ci -Aqm "added d"
       
   106 
       
   107   $ hg glog
       
   108   @  7:d48a30875f01 added d
       
   109   |   () draft
       
   110   o  6:f89e4764f2ed added a b c
       
   111   |   () draft
       
   112   o  0:8fa14d15e168 added hgignore
       
   113       () draft
       
   114   $ hg prev
       
   115   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   116   [6] added a b c
       
   117   $ hg split -r . <<EOF
       
   118   > y
       
   119   > n
       
   120   > y
       
   121   > y
       
   122   > y
       
   123   > y
       
   124   > y
       
   125   > EOF
       
   126   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
   127   adding a
       
   128   adding b
       
   129   adding c
       
   130   diff --git a/a b/a
       
   131   new file mode 100644
       
   132   examine changes to 'a'? [Ynesfdaq?] y
       
   133   
       
   134   @@ -0,0 +1,1 @@
       
   135   +foo
       
   136   record change 1/3 to 'a'? [Ynesfdaq?] n
       
   137   
       
   138   diff --git a/b b/b
       
   139   new file mode 100644
       
   140   examine changes to 'b'? [Ynesfdaq?] y
       
   141   
       
   142   @@ -0,0 +1,1 @@
       
   143   +foo
       
   144   record change 2/3 to 'b'? [Ynesfdaq?] y
       
   145   
       
   146   diff --git a/c b/c
       
   147   new file mode 100644
       
   148   examine changes to 'c'? [Ynesfdaq?] y
       
   149   
       
   150   @@ -0,0 +1,1 @@
       
   151   +foo
       
   152   record change 3/3 to 'c'? [Ynesfdaq?] y
       
   153   
       
   154   created new head
       
   155   Done splitting? [yN] y
       
   156   1 new orphan changesets
       
   157 
       
   158   $ hg glog
       
   159   @  9:c0fbf8aaf6c4 added a b c
       
   160   |   () draft
       
   161   o  8:f2632392aefe added a b c
       
   162   |   () draft
       
   163   | *  7:d48a30875f01 added d
       
   164   | |   () draft
       
   165   | x  6:f89e4764f2ed added a b c
       
   166   |/    () draft
       
   167   o  0:8fa14d15e168 added hgignore
       
   168       () draft
       
   169 
       
   170   $ hg rebase -r . -d 8fa14d15e168
       
   171   rebasing 9:c0fbf8aaf6c4 "added a b c" (tip)
       
   172   $ hg glog
       
   173   @  10:7f87764e5b64 added a b c
       
   174   |   () draft
       
   175   | o  8:f2632392aefe added a b c
       
   176   |/    () draft
       
   177   | *  7:d48a30875f01 added d
       
   178   | |   () draft
       
   179   | x  6:f89e4764f2ed added a b c
       
   180   |/    () draft
       
   181   o  0:8fa14d15e168 added hgignore
       
   182       () draft
       
   183 
       
   184   $ hg evolve --dry-run
       
   185   cannot solve split across two branches
       
   186 
       
   187 XXX: this sounds like a good thing, maybe we should suggest using commands like
       
   188 grab or rebase to resolve this. Moreover showing the branch heads or list of
       
   189 successors on different branches will be good.
       
   190 
       
   191   $ hg evolve --all
       
   192   cannot solve split across two branches