tests/test-evolve.t
changeset 2020 143c8e4dc22d
parent 1806 9f42f819267b
child 2083 778afb036245
equal deleted inserted replaced
2019:996a562b6c9f 2020:143c8e4dc22d
       
     1   $ cat >> $HGRCPATH <<EOF
       
     2   > [defaults]
       
     3   > amend=-d "0 0"
       
     4   > fold=-d "0 0"
       
     5   > metaedit=-d "0 0"
       
     6   > [web]
       
     7   > push_ssl = false
       
     8   > allow_push = *
       
     9   > [phases]
       
    10   > publish = False
       
    11   > [alias]
       
    12   > qlog = log --template='{rev} - {node|short} {desc} ({phase})\n'
       
    13   > [diff]
       
    14   > git = 1
       
    15   > unified = 0
       
    16   > [extensions]
       
    17   > hgext.graphlog=
       
    18   > EOF
       
    19   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
       
    20   $ mkcommit() {
       
    21   >    echo "$1" > "$1"
       
    22   >    hg add "$1"
       
    23   >    hg ci -m "add $1"
       
    24   > }
       
    25 
       
    26   $ mkstack() {
       
    27   >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
       
    28   >    hg update $1 -C
       
    29   >    shift
       
    30   >    mkcommits $*
       
    31   > }
       
    32 
       
    33   $ glog() {
       
    34   >   hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
       
    35   > }
       
    36 
       
    37   $ shaof() {
       
    38   >   hg log -T {node} -r "first(desc($1))"
       
    39   > }
       
    40 
       
    41   $ mkcommits() {
       
    42   >   for i in $@; do mkcommit $i ; done
       
    43   > }
       
    44 
       
    45 Test the evolution test topic is installed
       
    46 
       
    47   $ hg help evolution
       
    48   Safely Rewriting History
       
    49   """"""""""""""""""""""""
       
    50   
       
    51       Obsolescence markers make it possible to mark changesets that have been
       
    52       deleted or superset in a new version of the changeset.
       
    53   
       
    54       Unlike the previous way of handling such changes, by stripping the old
       
    55       changesets from the repository, obsolescence markers can be propagated
       
    56       between repositories. This allows for a safe and simple way of exchanging
       
    57       mutable history and altering it after the fact. Changeset phases are
       
    58       respected, such that only draft and secret changesets can be altered (see
       
    59       'hg help phases' for details).
       
    60   
       
    61       Obsolescence is tracked using "obsolete markers", a piece of metadata
       
    62       tracking which changesets have been made obsolete, potential successors
       
    63       for a given changeset, the moment the changeset was marked as obsolete,
       
    64       and the user who performed the rewriting operation. The markers are stored
       
    65       separately from standard changeset data can be exchanged without any of
       
    66       the precursor changesets, preventing unnecessary exchange of obsolescence
       
    67       data.
       
    68   
       
    69       The complete set of obsolescence markers describes a history of changeset
       
    70       modifications that is orthogonal to the repository history of file
       
    71       modifications. This changeset history allows for detection and automatic
       
    72       resolution of edge cases arising from multiple users rewriting the same
       
    73       part of history concurrently.
       
    74   
       
    75       Current feature status
       
    76       ======================
       
    77   
       
    78       This feature is still in development.  If you see this help, you have
       
    79       enabled an extension that turned this feature on.
       
    80   
       
    81       Obsolescence markers will be exchanged between repositories that
       
    82       explicitly assert support for the obsolescence feature (this can currently
       
    83       only be done via an extension).
       
    84 
       
    85 various init
       
    86 
       
    87   $ hg init local
       
    88   $ cd local
       
    89   $ mkcommit a
       
    90   $ mkcommit b
       
    91   $ cat >> .hg/hgrc << EOF
       
    92   > [phases]
       
    93   > publish = True
       
    94   > EOF
       
    95   $ hg pull -q . # make 1 public
       
    96   $ rm .hg/hgrc
       
    97   $ mkcommit c
       
    98   $ mkcommit d
       
    99   $ hg up 1
       
   100   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   101   $ mkcommit e -q
       
   102   created new head
       
   103   $ mkcommit f
       
   104   $ hg qlog
       
   105   5 - e44648563c73 add f (draft)
       
   106   4 - fbb94e3a0ecf add e (draft)
       
   107   3 - 47d2a3944de8 add d (draft)
       
   108   2 - 4538525df7e2 add c (draft)
       
   109   1 - 7c3bad9141dc add b (public)
       
   110   0 - 1f0dee641bb7 add a (public)
       
   111 
       
   112 test kill and immutable changeset
       
   113 
       
   114   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
       
   115   1 public 
       
   116   $ hg prune 1
       
   117   abort: cannot prune immutable changeset: 7c3bad9141dc
       
   118   (see 'hg help phases' for details)
       
   119   [255]
       
   120   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
       
   121   1 public 
       
   122 
       
   123 test simple kill
       
   124 
       
   125   $ hg id -n
       
   126   5
       
   127   $ hg prune .
       
   128   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   129   working directory now at fbb94e3a0ecf
       
   130   1 changesets pruned
       
   131   $ hg qlog
       
   132   4 - fbb94e3a0ecf add e (draft)
       
   133   3 - 47d2a3944de8 add d (draft)
       
   134   2 - 4538525df7e2 add c (draft)
       
   135   1 - 7c3bad9141dc add b (public)
       
   136   0 - 1f0dee641bb7 add a (public)
       
   137 
       
   138 test multiple kill
       
   139 
       
   140   $ hg prune 4 -r 3
       
   141   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   142   working directory now at 7c3bad9141dc
       
   143   2 changesets pruned
       
   144   $ hg qlog
       
   145   2 - 4538525df7e2 add c (draft)
       
   146   1 - 7c3bad9141dc add b (public)
       
   147   0 - 1f0dee641bb7 add a (public)
       
   148 
       
   149 test kill with dirty changes
       
   150 
       
   151   $ hg up 2
       
   152   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   153   $ echo 4 > g
       
   154   $ hg add g
       
   155   $ hg prune .
       
   156   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   157   working directory now at 7c3bad9141dc
       
   158   1 changesets pruned
       
   159   $ hg st
       
   160   A g
       
   161 
       
   162 Smoketest debugobsrelsethashtree:
       
   163 
       
   164   $ hg debugobsrelsethashtree
       
   165   1f0dee641bb7258c56bd60e93edfa2405381c41e 0000000000000000000000000000000000000000
       
   166   7c3bad9141dcb46ff89abf5f61856facd56e476c * (glob)
       
   167   4538525df7e2b9f09423636c61ef63a4cb872a2d * (glob)
       
   168   47d2a3944de8b013de3be9578e8e344ea2e6c097 * (glob)
       
   169   fbb94e3a0ecf6d20c2cc31152ef162ce45af982f * (glob)
       
   170   e44648563c73f75950076031c6fdf06629de95f1 * (glob)
       
   171 
       
   172   $ cd ..
       
   173 
       
   174 ##########################
       
   175 importing Parren test
       
   176 ##########################
       
   177 
       
   178   $ cat << EOF >> $HGRCPATH
       
   179   > [ui]
       
   180   > logtemplate = "{rev}\t{bookmarks}: {desc|firstline} - {author|user}\n"
       
   181   > EOF
       
   182 
       
   183 Creating And Updating Changeset
       
   184 ===============================
       
   185 
       
   186 Setup the Base Repo
       
   187 -------------------
       
   188 
       
   189 We start with a plain base repo::
       
   190 
       
   191   $ hg init main; cd main
       
   192   $ cat >main-file-1 <<-EOF
       
   193   > One
       
   194   > 
       
   195   > Two
       
   196   > 
       
   197   > Three
       
   198   > EOF
       
   199   $ echo Two >main-file-2
       
   200   $ hg add
       
   201   adding main-file-1
       
   202   adding main-file-2
       
   203   $ hg commit --message base
       
   204   $ cd ..
       
   205 
       
   206 and clone this into a new repo where we do our work::
       
   207 
       
   208   $ hg clone main work
       
   209   updating to branch default
       
   210   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   211   $ cd work
       
   212 
       
   213 
       
   214 Create First Patch
       
   215 ------------------
       
   216 
       
   217 To begin with, we just do the changes that will be the initial version of the changeset::
       
   218 
       
   219   $ echo One >file-from-A
       
   220   $ sed -i'' -e s/One/Eins/ main-file-1
       
   221   $ hg add file-from-A
       
   222 
       
   223 So this is what we would like our changeset to be::
       
   224 
       
   225   $ hg diff
       
   226   diff --git a/file-from-A b/file-from-A
       
   227   new file mode 100644
       
   228   --- /dev/null
       
   229   +++ b/file-from-A
       
   230   @@ -0,0 +1,1 @@
       
   231   +One
       
   232   diff --git a/main-file-1 b/main-file-1
       
   233   --- a/main-file-1
       
   234   +++ b/main-file-1
       
   235   @@ -1,1 +1,1 @@
       
   236   -One
       
   237   +Eins
       
   238 
       
   239 To commit it we just - commit it::
       
   240 
       
   241   $ hg commit --message "a nifty feature"
       
   242 
       
   243 and place a bookmark so we can easily refer to it again (which we could have done before the commit)::
       
   244 
       
   245   $ hg book feature-A
       
   246 
       
   247 
       
   248 Create Second Patch
       
   249 -------------------
       
   250 
       
   251 Let's do this again for the second changeset::
       
   252 
       
   253   $ echo Two >file-from-B
       
   254   $ sed -i'' -e s/Two/Zwie/ main-file-1
       
   255   $ hg add file-from-B
       
   256 
       
   257 Before committing, however, we need to switch to a new bookmark for the second
       
   258 changeset. Otherwise we would inadvertently move the bookmark for our first changeset.
       
   259 It is therefore advisable to always set the bookmark before committing::
       
   260 
       
   261   $ hg book feature-B
       
   262   $ hg commit --message "another feature (child of $(hg log -r . -T '{node|short}'))"
       
   263 
       
   264 So here we are::
       
   265 
       
   266   $ hg book
       
   267      feature-A                 1:568a468b60fc
       
   268    * feature-B                 2:73296a82292a
       
   269 
       
   270 
       
   271 Fix The Second Patch
       
   272 --------------------
       
   273 
       
   274 There's a typo in feature-B. We spelled *Zwie* instead of *Zwei*::
       
   275 
       
   276   $ hg diff --change tip | grep -F Zwie
       
   277   +Zwie
       
   278 
       
   279 Fixing this is very easy. Just change::
       
   280 
       
   281   $ sed -i'' -e s/Zwie/Zwei/ main-file-1
       
   282 
       
   283 and **amend**::
       
   284 
       
   285   $ hg amend
       
   286 
       
   287 This results in a new single changeset for our amended changeset, and the old
       
   288 changeset plus the updating changeset are hidden from view by default::
       
   289 
       
   290   $ hg log
       
   291   4	feature-B: another feature (child of 568a468b60fc) - test
       
   292   1	feature-A: a nifty feature - test
       
   293   0	: base - test
       
   294 
       
   295   $ hg up feature-A -q
       
   296   $ hg bookmark -i feature-A
       
   297   $ sed -i'' -e s/Eins/Un/ main-file-1
       
   298 
       
   299 (amend of public changeset denied)
       
   300 
       
   301   $ hg phase --public 0 -v
       
   302   phase changed for 1 changesets
       
   303 
       
   304 
       
   305 (amend of on ancestors)
       
   306 
       
   307   $ hg amend
       
   308   1 new unstable changesets
       
   309   $ hg log
       
   310   6	feature-A: a nifty feature - test
       
   311   4	feature-B: another feature (child of 568a468b60fc) - test
       
   312   1	: a nifty feature - test
       
   313   0	: base - test
       
   314   $ hg up -q 0
       
   315   $ glog --hidden
       
   316   o  6:ba0ec09b1bab@default(draft) a nifty feature
       
   317   |
       
   318   | x  5:c296b79833d1@default(draft) temporary amend commit for 568a468b60fc
       
   319   | |
       
   320   | | o  4:6992c59c6b06@default(draft) another feature (child of 568a468b60fc)
       
   321   | |/
       
   322   | | x  3:c97947cdc7a2@default(draft) temporary amend commit for 73296a82292a
       
   323   | | |
       
   324   | | x  2:73296a82292a@default(draft) another feature (child of 568a468b60fc)
       
   325   | |/
       
   326   | x  1:568a468b60fc@default(draft) a nifty feature
       
   327   |/
       
   328   @  0:e55e0562ee93@default(public) base
       
   329   
       
   330   $ hg debugobsolete
       
   331   73296a82292a76fb8a7061969d2489ec0d84cd5e 6992c59c6b06a1b4a92e24ff884829ae026d018b 0 (*) {'user': 'test'} (glob)
       
   332   c97947cdc7a2a11cf78419f5c2c3dd3944ec79e8 0 {73296a82292a76fb8a7061969d2489ec0d84cd5e} (*) {'user': 'test'} (glob)
       
   333   568a468b60fc99a42d5d4ddbe181caff1eef308d ba0ec09b1babf3489b567853807f452edd46704f 0 (*) {'user': 'test'} (glob)
       
   334   c296b79833d1d497f33144786174bf35e04e44a3 0 {568a468b60fc99a42d5d4ddbe181caff1eef308d} (*) {'user': 'test'} (glob)
       
   335   $ hg evolve
       
   336   move:[4] another feature (child of 568a468b60fc)
       
   337   atop:[6] a nifty feature
       
   338   merging main-file-1
       
   339   working directory is now at 99833d22b0c6
       
   340   $ hg log
       
   341   7	feature-B: another feature (child of ba0ec09b1bab) - test
       
   342   6	feature-A: a nifty feature - test
       
   343   0	: base - test
       
   344 
       
   345 Test commit -o options
       
   346 
       
   347   $ hg up 6
       
   348   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   349   $ hg revert -r 7 --all
       
   350   adding file-from-B
       
   351   reverting main-file-1
       
   352   $ sed -i'' -e s/Zwei/deux/ main-file-1
       
   353   $ hg commit -m 'another feature that rox' -o 7
       
   354   created new head
       
   355   $ hg log
       
   356   8	feature-B: another feature that rox - test
       
   357   6	feature-A: a nifty feature - test
       
   358   0	: base - test
       
   359 
       
   360 phase change turning obsolete changeset public issue a bumped warning
       
   361 
       
   362   $ hg phase --hidden --public 7
       
   363   1 new bumped changesets
       
   364 
       
   365 all solving bumped troubled
       
   366 
       
   367   $ hg glog
       
   368   @  8	feature-B: another feature that rox - test
       
   369   |
       
   370   | o  7	: another feature (child of ba0ec09b1bab) - test
       
   371   |/
       
   372   o  6	feature-A: a nifty feature - test
       
   373   |
       
   374   o  0	: base - test
       
   375   
       
   376   $ hg evolve --any --traceback --bumped
       
   377   recreate:[8] another feature that rox
       
   378   atop:[7] another feature (child of ba0ec09b1bab)
       
   379   computing new diff
       
   380   committed as 6707c5e1c49d
       
   381   working directory is now at 6707c5e1c49d
       
   382   $ hg glog
       
   383   @  9	feature-B: bumped update to 99833d22b0c6: - test
       
   384   |
       
   385   o  7	: another feature (child of ba0ec09b1bab) - test
       
   386   |
       
   387   o  6	feature-A: a nifty feature - test
       
   388   |
       
   389   o  0	: base - test
       
   390   
       
   391   $ hg diff --hidden -r 9 -r 8
       
   392   $ hg diff -r 9^ -r 9
       
   393   diff --git a/main-file-1 b/main-file-1
       
   394   --- a/main-file-1
       
   395   +++ b/main-file-1
       
   396   @@ -3,1 +3,1 @@
       
   397   -Zwei
       
   398   +deux
       
   399   $ hg log -r 'bumped()' # no more bumped
       
   400 
       
   401 test evolve --all
       
   402   $ sed -i'' -e s/deux/to/ main-file-1
       
   403   $ hg commit -m 'dansk 2!'
       
   404   $ sed -i'' -e s/Three/tre/ main-file-1
       
   405   $ hg commit -m 'dansk 3!'
       
   406   $ hg update 9
       
   407   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   408   $ sed -i'' -e s/Un/Én/ main-file-1
       
   409   $ hg commit --amend -m 'dansk!'
       
   410   2 new unstable changesets
       
   411 
       
   412 (ninja test for the {trouble} template:
       
   413 
       
   414   $ hg log -G --template '{rev} {troubles}\n'
       
   415   @  13
       
   416   |
       
   417   | o  11 unstable
       
   418   | |
       
   419   | o  10 unstable
       
   420   | |
       
   421   | x  9
       
   422   |/
       
   423   o  7
       
   424   |
       
   425   o  6
       
   426   |
       
   427   o  0
       
   428   
       
   429 
       
   430 
       
   431 (/ninja)
       
   432 
       
   433   $ hg evolve --all --traceback
       
   434   move:[10] dansk 2!
       
   435   atop:[13] dansk!
       
   436   merging main-file-1
       
   437   move:[11] dansk 3!
       
   438   atop:[14] dansk 2!
       
   439   merging main-file-1
       
   440   working directory is now at 68557e4f0048
       
   441   $ hg glog
       
   442   @  15	: dansk 3! - test
       
   443   |
       
   444   o  14	: dansk 2! - test
       
   445   |
       
   446   o  13	feature-B: dansk! - test
       
   447   |
       
   448   o  7	: another feature (child of ba0ec09b1bab) - test
       
   449   |
       
   450   o  6	feature-A: a nifty feature - test
       
   451   |
       
   452   o  0	: base - test
       
   453   
       
   454 
       
   455   $ cd ..
       
   456 
       
   457 enable general delta
       
   458 
       
   459   $ cat << EOF >> $HGRCPATH
       
   460   > [format]
       
   461   > generaldelta=1
       
   462   > EOF
       
   463 
       
   464 
       
   465 
       
   466   $ hg init alpha
       
   467   $ cd alpha
       
   468   $ echo 'base' > firstfile
       
   469   $ hg add firstfile
       
   470   $ hg ci -m 'base'
       
   471 
       
   472   $ cd ..
       
   473   $ hg clone -Ur 0 alpha beta
       
   474   adding changesets
       
   475   adding manifests
       
   476   adding file changes
       
   477   added 1 changesets with 1 changes to 1 files
       
   478   $ cd alpha
       
   479 
       
   480   $ cat << EOF > A
       
   481   > We
       
   482   > need
       
   483   > some
       
   484   > kind
       
   485   > of 
       
   486   > file
       
   487   > big
       
   488   > enough
       
   489   > to
       
   490   > prevent
       
   491   > snapshot
       
   492   > .
       
   493   > yes
       
   494   > new
       
   495   > lines
       
   496   > are
       
   497   > useless
       
   498   > .
       
   499   > EOF
       
   500   $ hg add A
       
   501   $ hg commit -m 'adding A'
       
   502   $ hg mv A B
       
   503   $ echo '.' >> B
       
   504   $ hg amend -m 'add B'
       
   505   $ hg verify
       
   506   checking changesets
       
   507   checking manifests
       
   508   crosschecking files in changesets and manifests
       
   509   checking files
       
   510   3 files, 4 changesets, 4 total revisions
       
   511   $ hg --config extensions.hgext.mq= strip 'extinct()'
       
   512   abort: empty revision set
       
   513   [255]
       
   514   $ hg --config extensions.hgext.mq= strip --hidden 'extinct()'
       
   515   saved backup bundle to $TESTTMP/alpha/.hg/strip-backup/e87767087a57-d7bd82e9-backup.hg (glob)
       
   516   $ hg verify
       
   517   checking changesets
       
   518   checking manifests
       
   519   crosschecking files in changesets and manifests
       
   520   checking files
       
   521   2 files, 2 changesets, 2 total revisions
       
   522   $ cd ..
       
   523 
       
   524 Clone just this branch
       
   525 
       
   526   $ cd beta
       
   527   $ hg pull -r tip ../alpha
       
   528   pulling from ../alpha
       
   529   searching for changes
       
   530   adding changesets
       
   531   adding manifests
       
   532   adding file changes
       
   533   added 1 changesets with 1 changes to 1 files
       
   534   2 new obsolescence markers
       
   535   (run 'hg update' to get a working copy)
       
   536   $ hg up
       
   537   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   538 
       
   539   $ cd ..
       
   540 
       
   541 Test graft --obsolete/--old-obsolete
       
   542 
       
   543   $ hg init test-graft
       
   544   $ cd test-graft
       
   545   $ mkcommit 0
       
   546   $ mkcommit 1
       
   547   $ mkcommit 2
       
   548   $ mkcommit 3
       
   549   $ hg up -qC 0
       
   550   $ mkcommit 4
       
   551   created new head
       
   552   $ glog --hidden
       
   553   @  4:ce341209337f@default(draft) add 4
       
   554   |
       
   555   | o  3:0e84df4912da@default(draft) add 3
       
   556   | |
       
   557   | o  2:db038628b9e5@default(draft) add 2
       
   558   | |
       
   559   | o  1:73d38bb17fd7@default(draft) add 1
       
   560   |/
       
   561   o  0:8685c6d34325@default(draft) add 0
       
   562   
       
   563   $ hg graft -r3 -O
       
   564   grafting 3:0e84df4912da "add 3"
       
   565   $ hg graft -r1 -o 2
       
   566   grafting 1:73d38bb17fd7 "add 1"
       
   567   $ glog --hidden
       
   568   @  6:acb28cd497b7@default(draft) add 1
       
   569   |
       
   570   o  5:0b9e50c35132@default(draft) add 3
       
   571   |
       
   572   o  4:ce341209337f@default(draft) add 4
       
   573   |
       
   574   | x  3:0e84df4912da@default(draft) add 3
       
   575   | |
       
   576   | x  2:db038628b9e5@default(draft) add 2
       
   577   | |
       
   578   | o  1:73d38bb17fd7@default(draft) add 1
       
   579   |/
       
   580   o  0:8685c6d34325@default(draft) add 0
       
   581   
       
   582   $ hg debugobsolete
       
   583   0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (*) {'user': 'test'} (glob)
       
   584   db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (*) {'user': 'test'} (glob)
       
   585 
       
   586 Test graft --continue
       
   587 
       
   588   $ hg up -qC 0
       
   589   $ echo 2 > 1
       
   590   $ hg ci -Am conflict 1
       
   591   created new head
       
   592   $ hg up -qC 6
       
   593   $ hg graft -O 7
       
   594   grafting 7:a5bfd90a2f29 "conflict" (tip)
       
   595   merging 1
       
   596   warning: conflicts while merging 1! (edit, then use 'hg resolve --mark')
       
   597   abort: unresolved conflicts, can't continue
       
   598   (use 'hg resolve' and 'hg graft --continue')
       
   599   [255]
       
   600   $ hg log -r7 --template '{rev}:{node|short} {obsolete}\n'
       
   601   7:a5bfd90a2f29 
       
   602   $ echo 3 > 1
       
   603   $ hg resolve -m 1
       
   604   (no more unresolved files)
       
   605   continue: hg graft --continue
       
   606   $ hg graft --continue -O
       
   607   grafting 7:a5bfd90a2f29 "conflict" (tip)
       
   608   $ glog --hidden
       
   609   @  8:920e58bb443b@default(draft) conflict
       
   610   |
       
   611   | x  7:a5bfd90a2f29@default(draft) conflict
       
   612   | |
       
   613   o |  6:acb28cd497b7@default(draft) add 1
       
   614   | |
       
   615   o |  5:0b9e50c35132@default(draft) add 3
       
   616   | |
       
   617   o |  4:ce341209337f@default(draft) add 4
       
   618   |/
       
   619   | x  3:0e84df4912da@default(draft) add 3
       
   620   | |
       
   621   | x  2:db038628b9e5@default(draft) add 2
       
   622   | |
       
   623   | o  1:73d38bb17fd7@default(draft) add 1
       
   624   |/
       
   625   o  0:8685c6d34325@default(draft) add 0
       
   626   
       
   627   $ hg debugobsolete
       
   628   0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (*) {'user': 'test'} (glob)
       
   629   db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (*) {'user': 'test'} (glob)
       
   630   a5bfd90a2f29c7ccb8f917ff4e5013a9053d0a04 920e58bb443b73eea9d6d65570b4241051ea3229 0 (*) {'user': 'test'} (glob)
       
   631 
       
   632 Test touch
       
   633 
       
   634   $ glog
       
   635   @  8:920e58bb443b@default(draft) conflict
       
   636   |
       
   637   o  6:acb28cd497b7@default(draft) add 1
       
   638   |
       
   639   o  5:0b9e50c35132@default(draft) add 3
       
   640   |
       
   641   o  4:ce341209337f@default(draft) add 4
       
   642   |
       
   643   | o  1:73d38bb17fd7@default(draft) add 1
       
   644   |/
       
   645   o  0:8685c6d34325@default(draft) add 0
       
   646   
       
   647   $ hg touch
       
   648   $ glog
       
   649   @  9:*@default(draft) conflict (glob)
       
   650   |
       
   651   o  6:acb28cd497b7@default(draft) add 1
       
   652   |
       
   653   o  5:0b9e50c35132@default(draft) add 3
       
   654   |
       
   655   o  4:ce341209337f@default(draft) add 4
       
   656   |
       
   657   | o  1:73d38bb17fd7@default(draft) add 1
       
   658   |/
       
   659   o  0:8685c6d34325@default(draft) add 0
       
   660   
       
   661   $ hg touch .
       
   662   $ glog
       
   663   @  10:*@default(draft) conflict (glob)
       
   664   |
       
   665   o  6:acb28cd497b7@default(draft) add 1
       
   666   |
       
   667   o  5:0b9e50c35132@default(draft) add 3
       
   668   |
       
   669   o  4:ce341209337f@default(draft) add 4
       
   670   |
       
   671   | o  1:73d38bb17fd7@default(draft) add 1
       
   672   |/
       
   673   o  0:8685c6d34325@default(draft) add 0
       
   674   
       
   675 
       
   676 Test fold
       
   677 
       
   678   $ rm *.orig
       
   679   $ hg fold
       
   680   abort: no revisions specified
       
   681   [255]
       
   682   $ hg fold --from
       
   683   abort: no revisions specified
       
   684   [255]
       
   685   $ hg fold .
       
   686   abort: must specify either --from or --exact
       
   687   [255]
       
   688   $ hg fold --from . --exact
       
   689   abort: cannot use both --from and --exact
       
   690   [255]
       
   691   $ hg fold --from .
       
   692   single revision specified, nothing to fold
       
   693   [1]
       
   694   $ hg fold 0::10 --rev 1 --exact
       
   695   abort: cannot fold non-linear revisions (multiple heads given)
       
   696   [255]
       
   697   $ hg fold -r 4 -r 6 --exact
       
   698   abort: cannot fold non-linear revisions (multiple roots given)
       
   699   [255]
       
   700   $ hg fold --from 10 1
       
   701   abort: cannot fold non-linear revisions
       
   702   (given revisions are unrelated to parent of working directory)
       
   703   [255]
       
   704   $ hg fold --exact -r "4 and not 4"
       
   705   abort: specified revisions evaluate to an empty set
       
   706   (use different revision arguments)
       
   707   [255]
       
   708   $ hg phase --public 0
       
   709   $ hg fold --from -r 0
       
   710   abort: cannot fold public revisions
       
   711   [255]
       
   712   $ hg fold --from -r 5
       
   713   3 changesets folded
       
   714   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   715   $ hg fold --from 6 # want to run hg fold 6
       
   716   abort: hidden revision '6'!
       
   717   (use --hidden to access hidden revisions)
       
   718   [255]
       
   719   $ hg log -r 11 --template '{desc}\n'
       
   720   add 3
       
   721   
       
   722   
       
   723   add 1
       
   724   
       
   725   
       
   726   conflict
       
   727   $ hg debugrebuildstate
       
   728   $ hg st
       
   729 
       
   730 Test fold with wc parent is not the head of the folded revision
       
   731 
       
   732   $ hg up 4
       
   733   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   734   $ hg fold --rev 4::11 --user victor --exact
       
   735   2 changesets folded
       
   736   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   737   $ glog
       
   738   @  12:d26d339c513f@default(draft) add 4
       
   739   |
       
   740   | o  1:73d38bb17fd7@default(draft) add 1
       
   741   |/
       
   742   o  0:8685c6d34325@default(public) add 0
       
   743   
       
   744   $ hg log --template '{rev}: {author}\n'
       
   745   12: victor
       
   746   1: test
       
   747   0: test
       
   748   $ hg log -r 12 --template '{desc}\n'
       
   749   add 4
       
   750   
       
   751   
       
   752   add 3
       
   753   
       
   754   
       
   755   add 1
       
   756   
       
   757   
       
   758   conflict
       
   759   $ hg debugrebuildstate
       
   760   $ hg st
       
   761 
       
   762 Test olog
       
   763 
       
   764   $ hg olog
       
   765   4	: add 4 - test
       
   766   11	: add 3 - test
       
   767 
       
   768 Test obsstore stat
       
   769 
       
   770   $ hg debugobsstorestat
       
   771   markers total:                     10
       
   772       for known precursors:          10
       
   773       with parents data:              0
       
   774   markers with no successors:         0
       
   775                 1 successors:        10
       
   776                 2 successors:         0
       
   777       more than 2 successors:         0
       
   778       available  keys:
       
   779                  user:               10
       
   780   disconnected clusters:              1
       
   781           any known node:             1
       
   782           smallest length:           10
       
   783           longer length:             10
       
   784           median length:             10
       
   785           mean length:               10
       
   786       using parents data:             1
       
   787           any known node:             1
       
   788           smallest length:           10
       
   789           longer length:             10
       
   790           median length:             10
       
   791           mean length:               10
       
   792 
       
   793 
       
   794 Test evolving renames
       
   795 
       
   796   $ hg up null
       
   797   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
   798   $ echo a > a
       
   799   $ hg ci -Am a
       
   800   adding a
       
   801   created new head
       
   802   $ echo b > b
       
   803   $ hg ci -Am b
       
   804   adding b
       
   805   $ hg mv a c
       
   806   $ hg ci -m c
       
   807   $ hg prune .^
       
   808   1 changesets pruned
       
   809   1 new unstable changesets
       
   810   $ hg stab --any
       
   811   move:[15] c
       
   812   atop:[13] a
       
   813   working directory is now at 3742bde73477
       
   814   $ hg st -C --change=tip
       
   815   A c
       
   816     a
       
   817   R a
       
   818 
       
   819 Test fold with commit messages
       
   820 
       
   821   $ cd ../work
       
   822   $ hg fold --from .^ --message "Folding with custom commit message"
       
   823   2 changesets folded
       
   824   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   825   $ glog
       
   826   @  16:98cb758db56d@default(draft) Folding with custom commit message
       
   827   |
       
   828   o  13:0a2f9b959bb4@default(draft) dansk!
       
   829   |
       
   830   o  7:99833d22b0c6@default(public) another feature (child of ba0ec09b1bab)
       
   831   |
       
   832   o  6:ba0ec09b1bab@default(public) a nifty feature
       
   833   |
       
   834   o  0:e55e0562ee93@default(public) base
       
   835   
       
   836   $ cat > commit-message <<EOF
       
   837   > A longer
       
   838   >                   commit message
       
   839   > EOF
       
   840 
       
   841   $ hg fold --from .^ --logfile commit-message
       
   842   2 changesets folded
       
   843   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   844   $ hg qlog
       
   845   17 - a00182c58888 A longer
       
   846                     commit message (draft)
       
   847   7 - 99833d22b0c6 another feature (child of ba0ec09b1bab) (public)
       
   848   6 - ba0ec09b1bab a nifty feature (public)
       
   849   0 - e55e0562ee93 base (public)
       
   850 
       
   851   $ cd ..
       
   852 
       
   853 Test branch preservation:
       
   854 ===========================
       
   855 
       
   856   $ hg init evolving-branch
       
   857   $ cd evolving-branch
       
   858   $ touch a
       
   859   $ hg add a
       
   860   $ hg ci -m 'a0'
       
   861   $ echo 1 > a
       
   862   $ hg ci -m 'a1'
       
   863   $ echo 2 > a
       
   864   $ hg ci -m 'a2'
       
   865   $ echo 3 > a
       
   866   $ hg ci -m 'a3'
       
   867 
       
   868   $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n'
       
   869   @  3 [default] a3
       
   870   |
       
   871   o  2 [default] a2
       
   872   |
       
   873   o  1 [default] a1
       
   874   |
       
   875   o  0 [default] a0
       
   876   
       
   877 
       
   878 branch change propagated
       
   879 
       
   880   $ hg up 'desc(a2)'
       
   881   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   882   $ hg branch mybranch
       
   883   marked working directory as branch mybranch
       
   884   (branches are permanent and global, did you want a bookmark?)
       
   885   $ hg amend
       
   886   1 new unstable changesets
       
   887 
       
   888   $ hg evolve
       
   889   move:[3] a3
       
   890   atop:[5] a2
       
   891   working directory is now at 7c5649f73d11
       
   892 
       
   893   $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n'
       
   894   @  6 [mybranch] a3
       
   895   |
       
   896   o  5 [mybranch] a2
       
   897   |
       
   898   o  1 [default] a1
       
   899   |
       
   900   o  0 [default] a0
       
   901   
       
   902 
       
   903 branch change preserved
       
   904 
       
   905   $ hg up 'desc(a1)'
       
   906   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   907   $ hg amend -m 'a1_'
       
   908   2 new unstable changesets
       
   909   $ hg evolve
       
   910   move:[5] a2
       
   911   atop:[7] a1_
       
   912   working directory is now at eb07e22a0e63
       
   913   $ hg evolve
       
   914   move:[6] a3
       
   915   atop:[8] a2
       
   916   working directory is now at 777c26ca5e78
       
   917   $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n'
       
   918   @  9 [mybranch] a3
       
   919   |
       
   920   o  8 [mybranch] a2
       
   921   |
       
   922   o  7 [default] a1_
       
   923   |
       
   924   o  0 [default] a0
       
   925   
       
   926 
       
   927 Evolve from the middle of a stack pick the right changesets.
       
   928 
       
   929   $ hg up 7
       
   930   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   931   $ hg ci --amend -m 'a1__'
       
   932   2 new unstable changesets
       
   933 
       
   934   $ hg up 8
       
   935   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   936   $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n'
       
   937   o  10 [default] a1__
       
   938   |
       
   939   | o  9 [mybranch] a3
       
   940   | |
       
   941   | @  8 [mybranch] a2
       
   942   | |
       
   943   | x  7 [default] a1_
       
   944   |/
       
   945   o  0 [default] a0
       
   946   
       
   947   $ hg evolve
       
   948   nothing to evolve on current working copy parent
       
   949   (2 other unstable in the repository, do you want --any or --rev)
       
   950   [2]
       
   951 
       
   952 
       
   953 Evolve disables active bookmarks.
       
   954 
       
   955   $ hg up 10
       
   956   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   957   $ hg bookmark testbookmark
       
   958   $ ls .hg/bookmarks*
       
   959   .hg/bookmarks
       
   960   .hg/bookmarks.* (glob)
       
   961   $ hg evolve
       
   962   move:[8] a2
       
   963   atop:[10] a1__
       
   964   (leaving bookmark testbookmark)
       
   965   working directory is now at d952e93add6f
       
   966   $ ls .hg/bookmarks*
       
   967   .hg/bookmarks
       
   968 
       
   969 Possibility to select what trouble to solve first, asking for bumped before
       
   970 divergent
       
   971   $ hg up 10
       
   972   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   973   $ hg revert -r 11 --all
       
   974   reverting a
       
   975   $ hg log -G --template '{rev} [{branch}] {desc|firstline}\n'
       
   976   o  11 [mybranch] a2
       
   977   |
       
   978   @  10 [default] a1__
       
   979   |
       
   980   | o  9 [mybranch] a3
       
   981   | |
       
   982   | x  8 [mybranch] a2
       
   983   | |
       
   984   | x  7 [default] a1_
       
   985   |/
       
   986   o  0 [default] a0
       
   987   
       
   988   $ echo "hello world" > newfile
       
   989   $ hg add newfile
       
   990   $ hg commit -m "add new file bumped" -o 11
       
   991   $ hg phase --public --hidden 11
       
   992   1 new bumped changesets
       
   993   $ hg glog
       
   994   @  12	: add new file bumped - test
       
   995   |
       
   996   | o  11	: a2 - test
       
   997   |/
       
   998   o  10	testbookmark: a1__ - test
       
   999   |
       
  1000   | o  9	: a3 - test
       
  1001   | |
       
  1002   | x  8	: a2 - test
       
  1003   | |
       
  1004   | x  7	: a1_ - test
       
  1005   |/
       
  1006   o  0	: a0 - test
       
  1007   
       
  1008 
       
  1009 Now we have a bumped and an unstable changeset, we solve the bumped first
       
  1010 normally the unstable changeset would be solve first
       
  1011 
       
  1012   $ hg glog
       
  1013   @  12	: add new file bumped - test
       
  1014   |
       
  1015   | o  11	: a2 - test
       
  1016   |/
       
  1017   o  10	testbookmark: a1__ - test
       
  1018   |
       
  1019   | o  9	: a3 - test
       
  1020   | |
       
  1021   | x  8	: a2 - test
       
  1022   | |
       
  1023   | x  7	: a1_ - test
       
  1024   |/
       
  1025   o  0	: a0 - test
       
  1026   
       
  1027   $ hg evolve -r 12 --bumped
       
  1028   recreate:[12] add new file bumped
       
  1029   atop:[11] a2
       
  1030   computing new diff
       
  1031   committed as f15d32934071
       
  1032   working directory is now at f15d32934071
       
  1033   $ hg evolve --any
       
  1034   move:[9] a3
       
  1035   atop:[13] bumped update to d952e93add6f:
       
  1036   working directory is now at cce26b684bfe
       
  1037 Check that we can resolve troubles in a revset with more than one commit
       
  1038   $ hg up 14 -C
       
  1039   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1040   $ mkcommit gg
       
  1041   $ hg up 14 
       
  1042   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
  1043   $ mkcommit gh
       
  1044   created new head
       
  1045   $ hg up 14 
       
  1046   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
  1047   $ printf "newline\nnewline\n" >> a
       
  1048   $ hg glog
       
  1049   o  16	: add gh - test
       
  1050   |
       
  1051   | o  15	: add gg - test
       
  1052   |/
       
  1053   @  14	: a3 - test
       
  1054   |
       
  1055   o  13	: bumped update to d952e93add6f: - test
       
  1056   |
       
  1057   o  11	: a2 - test
       
  1058   |
       
  1059   o  10	testbookmark: a1__ - test
       
  1060   |
       
  1061   o  0	: a0 - test
       
  1062   
       
  1063   $ hg amend
       
  1064   2 new unstable changesets
       
  1065   $ hg glog
       
  1066   @  18	: a3 - test
       
  1067   |
       
  1068   | o  16	: add gh - test
       
  1069   | |
       
  1070   | | o  15	: add gg - test
       
  1071   | |/
       
  1072   | x  14	: a3 - test
       
  1073   |/
       
  1074   o  13	: bumped update to d952e93add6f: - test
       
  1075   |
       
  1076   o  11	: a2 - test
       
  1077   |
       
  1078   o  10	testbookmark: a1__ - test
       
  1079   |
       
  1080   o  0	: a0 - test
       
  1081   
       
  1082 
       
  1083 Evolving an empty revset should do nothing
       
  1084   $ hg evolve --rev "16 and 15"
       
  1085   set of specified revisions is empty
       
  1086   [1]
       
  1087 
       
  1088   $ hg evolve --rev "14::" --bumped
       
  1089   no bumped changesets in specified revisions
       
  1090   (do you want to use --unstable)
       
  1091   [2]
       
  1092   $ hg evolve --rev "14::" --unstable
       
  1093   move:[15] add gg
       
  1094   atop:[18] a3
       
  1095   move:[16] add gh
       
  1096   atop:[18] a3
       
  1097   working directory is now at e02107f98737
       
  1098   $ hg glog
       
  1099   @  20	: add gh - test
       
  1100   |
       
  1101   | o  19	: add gg - test
       
  1102   |/
       
  1103   o  18	: a3 - test
       
  1104   |
       
  1105   o  13	: bumped update to d952e93add6f: - test
       
  1106   |
       
  1107   o  11	: a2 - test
       
  1108   |
       
  1109   o  10	testbookmark: a1__ - test
       
  1110   |
       
  1111   o  0	: a0 - test
       
  1112   
       
  1113 Enabling commands selectively, no command enabled, next and fold and unknown
       
  1114   $ cat >> $HGRCPATH <<EOF
       
  1115   > [experimental]
       
  1116   > evolution=createmarkers
       
  1117   > EOF
       
  1118   $ hg next
       
  1119   hg: unknown command 'next'
       
  1120   Mercurial Distributed SCM
       
  1121   
       
  1122   basic commands:
       
  1123   
       
  1124    add           add the specified files on the next commit
       
  1125    annotate      show changeset information by line for each file
       
  1126    clone         make a copy of an existing repository
       
  1127    commit        commit the specified files or all outstanding changes
       
  1128    diff          diff repository (or selected files)
       
  1129    export        dump the header and diffs for one or more changesets
       
  1130    forget        forget the specified files on the next commit
       
  1131    init          create a new repository in the given directory
       
  1132    log           show revision history of entire repository or files
       
  1133    merge         merge another revision into working directory
       
  1134    pull          pull changes from the specified source
       
  1135    push          push changes to the specified destination
       
  1136    remove        remove the specified files on the next commit
       
  1137    serve         start stand-alone webserver
       
  1138    status        show changed files in the working directory
       
  1139    summary       summarize working directory state
       
  1140    update        update working directory (or switch revisions)
       
  1141   
       
  1142   (use 'hg help' for the full list of commands or 'hg -v' for details)
       
  1143   [255]
       
  1144   $ hg fold
       
  1145   hg: unknown command 'fold'
       
  1146   Mercurial Distributed SCM
       
  1147   
       
  1148   basic commands:
       
  1149   
       
  1150    add           add the specified files on the next commit
       
  1151    annotate      show changeset information by line for each file
       
  1152    clone         make a copy of an existing repository
       
  1153    commit        commit the specified files or all outstanding changes
       
  1154    diff          diff repository (or selected files)
       
  1155    export        dump the header and diffs for one or more changesets
       
  1156    forget        forget the specified files on the next commit
       
  1157    init          create a new repository in the given directory
       
  1158    log           show revision history of entire repository or files
       
  1159    merge         merge another revision into working directory
       
  1160    pull          pull changes from the specified source
       
  1161    push          push changes to the specified destination
       
  1162    remove        remove the specified files on the next commit
       
  1163    serve         start stand-alone webserver
       
  1164    status        show changed files in the working directory
       
  1165    summary       summarize working directory state
       
  1166    update        update working directory (or switch revisions)
       
  1167   
       
  1168   (use 'hg help' for the full list of commands or 'hg -v' for details)
       
  1169   [255]
       
  1170 Enabling commands selectively, only fold enabled, next is still unknown
       
  1171   $ cat >> $HGRCPATH <<EOF
       
  1172   > [experimental]
       
  1173   > evolution=createmarkers
       
  1174   > evolutioncommands=fold
       
  1175   > EOF
       
  1176   $ hg fold
       
  1177   abort: no revisions specified
       
  1178   [255]
       
  1179   $ hg next
       
  1180   hg: unknown command 'next'
       
  1181   Mercurial Distributed SCM
       
  1182   
       
  1183   basic commands:
       
  1184   
       
  1185    add           add the specified files on the next commit
       
  1186    annotate      show changeset information by line for each file
       
  1187    clone         make a copy of an existing repository
       
  1188    commit        commit the specified files or all outstanding changes
       
  1189    diff          diff repository (or selected files)
       
  1190    export        dump the header and diffs for one or more changesets
       
  1191    fold          fold multiple revisions into a single one
       
  1192    forget        forget the specified files on the next commit
       
  1193    init          create a new repository in the given directory
       
  1194    log           show revision history of entire repository or files
       
  1195    merge         merge another revision into working directory
       
  1196    pull          pull changes from the specified source
       
  1197    push          push changes to the specified destination
       
  1198    remove        remove the specified files on the next commit
       
  1199    serve         start stand-alone webserver
       
  1200    status        show changed files in the working directory
       
  1201    summary       summarize working directory state
       
  1202    update        update working directory (or switch revisions)
       
  1203   
       
  1204   (use 'hg help' for the full list of commands or 'hg -v' for details)
       
  1205   [255]
       
  1206 
       
  1207 Restore all of the evolution features
       
  1208 
       
  1209   $ cat >> $HGRCPATH <<EOF
       
  1210   > [experimental]
       
  1211   > evolution=all
       
  1212   > EOF
       
  1213 
       
  1214 Check hg evolve --rev on singled out commit
       
  1215   $ hg up 19 -C
       
  1216   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
  1217   $ mkcommit j1
       
  1218   $ mkcommit j2
       
  1219   $ mkcommit j3
       
  1220   $ hg up .^^
       
  1221   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
  1222   $ echo "hello" > j4
       
  1223   $ hg add j4
       
  1224   $ hg amend
       
  1225   2 new unstable changesets
       
  1226   $ glog -r "18::"
       
  1227   @  25:8dc373be86d9@default(draft) add j1
       
  1228   |
       
  1229   | o  23:d7eadcf6eccd@default(draft) add j3
       
  1230   | |
       
  1231   | o  22:2223ea564144@default(draft) add j2
       
  1232   | |
       
  1233   | x  21:48490698b269@default(draft) add j1
       
  1234   |/
       
  1235   | o  20:e02107f98737@default(draft) add gh
       
  1236   | |
       
  1237   o |  19:24e63b319adf@default(draft) add gg
       
  1238   |/
       
  1239   o  18:edc3c9de504e@default(draft) a3
       
  1240   |
       
  1241   ~
       
  1242 
       
  1243   $ hg evolve --rev 23 --any
       
  1244   abort: cannot specify both "--rev" and "--any"
       
  1245   [255]
       
  1246   $ hg evolve --rev 23
       
  1247   cannot solve instability of d7eadcf6eccd, skipping
       
  1248 
       
  1249 Check that uncommit respects the allowunstable option
       
  1250 With only createmarkers we can only uncommit on a head
       
  1251   $ cat >> $HGRCPATH <<EOF
       
  1252   > [experimental]
       
  1253   > evolution=createmarkers, allnewcommands
       
  1254   > EOF
       
  1255   $ hg up 8dc373be86d9^
       
  1256   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
  1257   $ hg uncommit --all
       
  1258   abort: cannot uncommit in the middle of a stack
       
  1259   [255]
       
  1260   $ hg up 8dc373be86d9
       
  1261   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1262   $ hg uncommit --all
       
  1263   new changeset is empty
       
  1264   (use 'hg prune .' to remove it)
       
  1265   $ glog -r "18::"
       
  1266   @  26:044804d0c10d@default(draft) add j1
       
  1267   |
       
  1268   | o  23:d7eadcf6eccd@default(draft) add j3
       
  1269   | |
       
  1270   | o  22:2223ea564144@default(draft) add j2
       
  1271   | |
       
  1272   | x  21:48490698b269@default(draft) add j1
       
  1273   |/
       
  1274   | o  20:e02107f98737@default(draft) add gh
       
  1275   | |
       
  1276   o |  19:24e63b319adf@default(draft) add gg
       
  1277   |/
       
  1278   o  18:edc3c9de504e@default(draft) a3
       
  1279   |
       
  1280   ~
       
  1281 
       
  1282 Check that prune respects the allowunstable option
       
  1283   $ hg up -C .
       
  1284   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1285   $ hg up 20
       
  1286   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
  1287   $ hg evolve --all
       
  1288   nothing to evolve on current working copy parent
       
  1289   (2 other unstable in the repository, do you want --any or --rev)
       
  1290   [2]
       
  1291   $ hg evolve --all --any
       
  1292   move:[22] add j2
       
  1293   atop:[26] add j1
       
  1294   move:[23] add j3
       
  1295   atop:[27] add j2
       
  1296   working directory is now at c9a20e2d74aa
       
  1297   $ glog -r "18::"
       
  1298   @  28:c9a20e2d74aa@default(draft) add j3
       
  1299   |
       
  1300   o  27:b0e3066231e2@default(draft) add j2
       
  1301   |
       
  1302   o  26:044804d0c10d@default(draft) add j1
       
  1303   |
       
  1304   | o  20:e02107f98737@default(draft) add gh
       
  1305   | |
       
  1306   o |  19:24e63b319adf@default(draft) add gg
       
  1307   |/
       
  1308   o  18:edc3c9de504e@default(draft) a3
       
  1309   |
       
  1310   ~
       
  1311   $ hg up 19
       
  1312   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
  1313   $ mkcommit c5_
       
  1314   created new head
       
  1315   $ hg prune '26 + 27'
       
  1316   abort: cannot prune in the middle of a stack
       
  1317   (new unstable changesets are not allowed)
       
  1318   [255]
       
  1319   $ hg prune '19::28'
       
  1320   abort: cannot prune in the middle of a stack
       
  1321   (new unstable changesets are not allowed)
       
  1322   [255]
       
  1323   $ hg prune '26::'
       
  1324   3 changesets pruned
       
  1325   $ glog -r "18::"
       
  1326   @  29:2251801b6c91@default(draft) add c5_
       
  1327   |
       
  1328   | o  20:e02107f98737@default(draft) add gh
       
  1329   | |
       
  1330   o |  19:24e63b319adf@default(draft) add gg
       
  1331   |/
       
  1332   o  18:edc3c9de504e@default(draft) a3
       
  1333   |
       
  1334   ~
       
  1335 
       
  1336 Check that fold respects the allowunstable option
       
  1337   $ hg up edc3c9de504e
       
  1338   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
  1339   $ mkcommit unstableifparentisfolded
       
  1340   created new head
       
  1341   $ glog -r "18::"
       
  1342   @  30:68330ac625b8@default(draft) add unstableifparentisfolded
       
  1343   |
       
  1344   | o  29:2251801b6c91@default(draft) add c5_
       
  1345   | |
       
  1346   +---o  20:e02107f98737@default(draft) add gh
       
  1347   | |
       
  1348   | o  19:24e63b319adf@default(draft) add gg
       
  1349   |/
       
  1350   o  18:edc3c9de504e@default(draft) a3
       
  1351   |
       
  1352   ~
       
  1353 
       
  1354   $ hg fold --exact "19 + 18"
       
  1355   abort: cannot fold chain not ending with a head or with branching
       
  1356   (new unstable changesets are not allowed)
       
  1357   [255]
       
  1358   $ hg fold --exact "18::29"
       
  1359   abort: cannot fold chain not ending with a head or with branching
       
  1360   (new unstable changesets are not allowed)
       
  1361   [255]
       
  1362   $ hg fold --exact "19::"
       
  1363   2 changesets folded
       
  1364 
       
  1365 Check that evolve shows error while handling split commits
       
  1366 --------------------------------------
       
  1367 
       
  1368   $ cat >> $HGRCPATH <<EOF
       
  1369   > [experimental]
       
  1370   > evolution=all
       
  1371   > EOF
       
  1372 
       
  1373   $ glog -r "18::"
       
  1374   o  31:580886d07058@default(draft) add gg
       
  1375   |
       
  1376   | @  30:68330ac625b8@default(draft) add unstableifparentisfolded
       
  1377   |/
       
  1378   | o  20:e02107f98737@default(draft) add gh
       
  1379   |/
       
  1380   o  18:edc3c9de504e@default(draft) a3
       
  1381   |
       
  1382   ~
       
  1383 
       
  1384 Create a split commit
       
  1385   $ printf "oo" > oo;
       
  1386   $ printf "pp" > pp;
       
  1387   $ hg add oo pp
       
  1388   $ hg commit -m "oo+pp"
       
  1389   $ mkcommit uu
       
  1390   $ hg up 30
       
  1391   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
  1392   $ printf "oo" > oo;
       
  1393   $ hg add oo
       
  1394   $ hg commit -m "_oo"
       
  1395   created new head
       
  1396   $ printf "pp" > pp;
       
  1397   $ hg add pp
       
  1398   $ hg commit -m "_pp"
       
  1399   $ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
       
  1400   1 changesets pruned
       
  1401   1 new unstable changesets
       
  1402   $ glog -r "18::"
       
  1403   @  35:7a555adf2b4a@default(draft) _pp
       
  1404   |
       
  1405   o  34:2be4d2d5bf34@default(draft) _oo
       
  1406   |
       
  1407   | o  33:53f0c003e03e@default(draft) add uu
       
  1408   | |
       
  1409   | x  32:1bf2152f4f82@default(draft) oo+pp
       
  1410   |/
       
  1411   | o  31:580886d07058@default(draft) add gg
       
  1412   | |
       
  1413   o |  30:68330ac625b8@default(draft) add unstableifparentisfolded
       
  1414   |/
       
  1415   | o  20:e02107f98737@default(draft) add gh
       
  1416   |/
       
  1417   o  18:edc3c9de504e@default(draft) a3
       
  1418   |
       
  1419   ~
       
  1420   $ hg evolve --rev "18::"
       
  1421   move:[33] add uu
       
  1422   atop:[35] _pp
       
  1423   working directory is now at 43c3f5ef149f
       
  1424 
       
  1425 
       
  1426 Check that dirstate changes are kept at failure for conflicts (issue4966)
       
  1427 ----------------------------------------
       
  1428 
       
  1429   $ echo "will be amended" > newfile
       
  1430   $ hg commit -m "will be amended"
       
  1431   $ hg parents
       
  1432   37	: will be amended - test
       
  1433 
       
  1434   $ echo "will be evolved safely" >> a
       
  1435   $ hg commit -m "will be evolved safely"
       
  1436 
       
  1437   $ echo "will cause conflict at evolve" > newfile
       
  1438   $ echo "newly added" > newlyadded
       
  1439   $ hg add newlyadded
       
  1440   $ hg commit -m "will cause conflict at evolve"
       
  1441 
       
  1442   $ hg update -q 37
       
  1443   $ echo "amended" > newfile
       
  1444   $ hg amend -m "amended"
       
  1445   2 new unstable changesets
       
  1446 
       
  1447   $ hg evolve --rev "37::"
       
  1448   move:[38] will be evolved safely
       
  1449   atop:[41] amended
       
  1450   move:[39] will cause conflict at evolve
       
  1451   atop:[42] will be evolved safely
       
  1452   merging newfile
       
  1453   warning: conflicts while merging newfile! (edit, then use 'hg resolve --mark')
       
  1454   evolve failed!
       
  1455   fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort
       
  1456   abort: unresolved merge conflicts (see hg help resolve)
       
  1457   [255]
       
  1458 
       
  1459   $ glog -r "36::" --hidden
       
  1460   @  42:c904da5245b0@default(draft) will be evolved safely
       
  1461   |
       
  1462   o  41:34ae045ec400@default(draft) amended
       
  1463   |
       
  1464   | x  40:e88bee38ffc2@default(draft) temporary amend commit for 36030b147271
       
  1465   | |
       
  1466   | | o  39:02e943732647@default(draft) will cause conflict at evolve
       
  1467   | | |
       
  1468   | | x  38:f8e30e9317aa@default(draft) will be evolved safely
       
  1469   | |/
       
  1470   | x  37:36030b147271@default(draft) will be amended
       
  1471   |/
       
  1472   o  36:43c3f5ef149f@default(draft) add uu
       
  1473   |
       
  1474   ~
       
  1475 
       
  1476   $ hg status newlyadded
       
  1477   A newlyadded
       
  1478 
       
  1479 hg metaedit
       
  1480 -----------
       
  1481 
       
  1482   $ hg update --clean .
       
  1483   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1484   $ rm newlyadded
       
  1485   $ hg metaedit -r 0
       
  1486   abort: cannot edit commit information for public revisions
       
  1487   [255]
       
  1488   $ hg metaedit --fold
       
  1489   abort: revisions must be specified with --fold
       
  1490   [255]
       
  1491   $ hg metaedit -r 0 --fold
       
  1492   abort: cannot fold public revisions
       
  1493   [255]
       
  1494   $ hg metaedit '36 + 42' --fold
       
  1495   abort: cannot fold non-linear revisions (multiple roots given)
       
  1496   [255]
       
  1497   $ hg metaedit '36::39 + 41' --fold
       
  1498   abort: cannot fold non-linear revisions (multiple heads given)
       
  1499   [255]
       
  1500 check that metaedit respects allowunstable
       
  1501   $ hg metaedit '.^' --config 'experimental.evolution=createmarkers, allnewcommands'
       
  1502   abort: cannot edit commit information in the middle of a stack
       
  1503   (c904da5245b0 will become unstable and new unstable changes are not allowed)
       
  1504   [255]
       
  1505   $ hg metaedit '18::20' --fold --config 'experimental.evolution=createmarkers, allnewcommands'
       
  1506   abort: cannot fold chain not ending with a head or with branching
       
  1507   (new unstable changesets are not allowed)
       
  1508   [255]
       
  1509   $ hg metaedit --user foobar
       
  1510   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1511   $ hg log --template '{rev}: {author}\n' -r '42:' --hidden
       
  1512   42: test
       
  1513   43: foobar
       
  1514   $ hg log --template '{rev}: {author}\n' -r .
       
  1515   43: foobar
       
  1516 
       
  1517 TODO: support this
       
  1518   $ hg metaedit '.^::.'
       
  1519   abort: editing multiple revisions without --fold is not currently supported
       
  1520   [255]
       
  1521 
       
  1522   $ HGEDITOR=cat hg metaedit '.^::.' --fold
       
  1523   HG: This is a fold of 2 changesets.
       
  1524   HG: Commit message of changeset 41.
       
  1525   
       
  1526   amended
       
  1527   
       
  1528   HG: Commit message of changeset 43.
       
  1529   
       
  1530   will be evolved safely
       
  1531   
       
  1532   
       
  1533   
       
  1534   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
  1535   HG: Leave message empty to abort commit.
       
  1536   HG: --
       
  1537   HG: user: test
       
  1538   HG: branch 'default'
       
  1539   HG: changed a
       
  1540   HG: changed newfile
       
  1541   2 changesets folded
       
  1542   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1543 
       
  1544   $ glog -r .
       
  1545   @  44:41bf1183869c@default(draft) amended
       
  1546   |
       
  1547   ~
       
  1548 
       
  1549 no new commit is created here because the date is the same
       
  1550   $ HGEDITOR=cat hg metaedit
       
  1551   amended
       
  1552   
       
  1553   
       
  1554   will be evolved safely
       
  1555   
       
  1556   
       
  1557   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
  1558   HG: Leave message empty to abort commit.
       
  1559   HG: --
       
  1560   HG: user: test
       
  1561   HG: branch 'default'
       
  1562   HG: changed a
       
  1563   HG: changed newfile
       
  1564   nothing changed
       
  1565 
       
  1566   $ glog -r '.^::.'
       
  1567   @  44:41bf1183869c@default(draft) amended
       
  1568   |
       
  1569   o  36:43c3f5ef149f@default(draft) add uu
       
  1570   |
       
  1571   ~
       
  1572 
       
  1573 TODO: don't create a new commit in this case
       
  1574   $ hg metaedit --config defaults.metaedit=
       
  1575   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1576   $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n'
       
  1577   36: add uu
       
  1578   45: amended
       
  1579 
       
  1580   $ hg up .^
       
  1581   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
  1582   $ hg metaedit --user foobar2 45
       
  1583   $ hg log --template '{rev}: {author}\n' -r '42:' --hidden
       
  1584   42: test
       
  1585   43: foobar
       
  1586   44: test
       
  1587   45: test
       
  1588   46: foobar2
       
  1589   $ hg diff -r 45 -r 46 --hidden
       
  1590 
       
  1591 'fold' one commit
       
  1592   $ hg metaedit 39 --fold --user foobar3
       
  1593   1 changesets folded
       
  1594   $ hg log -r 47 --template '{rev}: {author}\n'
       
  1595   47: foobar3