Mercurial > hg-stable
changeset 17085:35729bdd59b6
tests: convert histedit tests to .t
Mostly a trivial conversion.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 30 Jun 2012 03:34:44 +0200 |
parents | 69dae7982c85 |
children | 5f2cacb715dc |
files | tests/histedit-helpers.sh tests/test-histedit-commute tests/test-histedit-commute.out tests/test-histedit-commute.t tests/test-histedit-drop tests/test-histedit-drop.out tests/test-histedit-drop.t tests/test-histedit-edit tests/test-histedit-edit.out tests/test-histedit-edit.t tests/test-histedit-fold tests/test-histedit-fold-non-commute tests/test-histedit-fold-non-commute.out tests/test-histedit-fold-non-commute.t tests/test-histedit-fold.out tests/test-histedit-fold.t tests/test-histedit-no-change tests/test-histedit-no-change.out tests/test-histedit-no-change.t tests/test-histedit-non-commute tests/test-histedit-non-commute-abort tests/test-histedit-non-commute-abort.out tests/test-histedit-non-commute-abort.t tests/test-histedit-non-commute.out tests/test-histedit-non-commute.t tests/test-histedit-outgoing tests/test-histedit-outgoing.out tests/test-histedit-outgoing.t |
diffstat | 28 files changed, 1557 insertions(+), 1655 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/histedit-helpers.sh Sat Jun 30 03:34:41 2012 +0200 +++ b/tests/histedit-helpers.sh Sat Jun 30 03:34:44 2012 +0200 @@ -1,5 +1,3 @@ -#!/bin/sh - fixbundle() { grep -v 'saving bundle' | grep -v 'saved backup' | \ grep -v added | grep -v adding | \
--- a/tests/test-histedit-commute Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick e860deea161a e -pick 652413bf663e f -pick 055a42cdd887 d -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done -} - -initrepo - -echo % log before edit -hg log --graph - -echo % show the edit commands offered -HGEDITOR=cat hg histedit 177f92b77385 - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % rules should end up in .hg/histedit-last-edit.txt: -cat .hg/histedit-last-edit.txt -echo '**** end of rules file ****' - -echo % log after edit -hg log --graph - -echo % put things back - -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 853c68da763f d -pick b069cc29fb22 e -pick 26f6a030ae82 f -EOF -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -hg log --graph - - -echo % slightly different this time - -cat > $EDITED <<EOF -pick 055a42cdd887 d -pick 652413bf663e f -pick e860deea161a e -pick 177f92b77385 c -EOF -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle -hg log --graph - - -echo % keep prevents stripping dead revs -cat > $EDITED <<EOF -pick bfe4a5a76b37 d -pick c4f52e213402 f -pick 99a62755c625 c -pick 7c6fdd608667 e -EOF -HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle -hg log --graph - -echo '% try with --rev' -cat > $EDITED <<EOF -pick 7c6fdd608667 e -pick 99a62755c625 c -EOF -hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle -hg log --graph - -echo % should also work if a commit message is missing -BUNDLE="$TESTDIR/missing-comment.hg" -hg init missing -cd missing -hg unbundle $BUNDLE -hg co tip -hg log --graph -hg histedit 0
--- a/tests/test-histedit-commute.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -% log before edit -@ changeset: 5:652413bf663e -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% show the edit commands offered -pick 177f92b77385 2 c -pick 055a42cdd887 3 d -pick e860deea161a 4 e -pick 652413bf663e 5 f - -# Edit history between 177f92b77385 and 652413bf663e -# -# Commands: -# p, pick = use commit -# e, edit = use commit, but stop for amending -# f, fold = use commit, but fold into previous commit (combines N and N-1) -# d, drop = remove commit from history -# m, mess = edit message without changing commit content -# -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% edit the history -0 files updated, 0 files merged, 3 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% rules should end up in .hg/histedit-last-edit.txt: -pick 177f92b77385 c -pick e860deea161a e -pick 652413bf663e f -pick 055a42cdd887 d -**** end of rules file **** -% log after edit -@ changeset: 5:853c68da763f -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 4:26f6a030ae82 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 3:b069cc29fb22 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% put things back -0 files updated, 0 files merged, 3 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 5:652413bf663e -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% slightly different this time -0 files updated, 0 files merged, 4 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 5:99a62755c625 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 4:7c6fdd608667 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:c4f52e213402 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 2:bfe4a5a76b37 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% keep prevents stripping dead revs -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 7:99e266581538 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 6:5ad36efb0653 -| parent: 3:c4f52e213402 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -| o changeset: 5:99a62755c625 -| | user: test -| | date: Thu Jan 01 00:00:00 1970 +0000 -| | summary: c -| | -| o changeset: 4:7c6fdd608667 -|/ user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:c4f52e213402 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 2:bfe4a5a76b37 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% try with --rev -abort: may not use changesets other than the ones listed -@ changeset: 7:99e266581538 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 6:5ad36efb0653 -| parent: 3:c4f52e213402 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -| o changeset: 5:99a62755c625 -| | user: test -| | date: Thu Jan 01 00:00:00 1970 +0000 -| | summary: c -| | -| o changeset: 4:7c6fdd608667 -|/ user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:c4f52e213402 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 2:bfe4a5a76b37 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% should also work if a commit message is missing -adding changesets -adding manifests -adding file changes -added 3 changesets with 3 changes to 1 files -(run 'hg update' to get a working copy) -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 2:bd22688093b3 -| tag: tip -| user: Robert Altman <robert.altman@telventDTN.com> -| date: Mon Nov 28 16:40:04 2011 +0000 -| summary: Update file. -| -o changeset: 1:3b3e956f9171 -| user: Robert Altman <robert.altman@telventDTN.com> -| date: Mon Nov 28 16:37:57 2011 +0000 -| -o changeset: 0:141947992243 - user: Robert Altman <robert.altman@telventDTN.com> - date: Mon Nov 28 16:35:28 2011 +0000 - summary: Checked in text file - -0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-commute.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,359 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick e860deea161a e + > pick 652413bf663e f + > pick 055a42cdd887 d + > EOF + $ initrepo () + > { + > hg init r + > cd r + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > } + + $ initrepo + +log before edit + $ hg log --graph + @ changeset: 5:652413bf663e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +show the edit commands offered + $ HGEDITOR=cat hg histedit 177f92b77385 + pick 177f92b77385 2 c + pick 055a42cdd887 3 d + pick e860deea161a 4 e + pick 652413bf663e 5 f + + # Edit history between 177f92b77385 and 652413bf663e + # + # Commands: + # p, pick = use commit + # e, edit = use commit, but stop for amending + # f, fold = use commit, but fold into previous commit (combines N and N-1) + # d, drop = remove commit from history + # m, mess = edit message without changing commit content + # + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +rules should end up in .hg/histedit-last-edit.txt: + $ cat .hg/histedit-last-edit.txt + pick 177f92b77385 c + pick e860deea161a e + pick 652413bf663e f + pick 055a42cdd887 d + +log after edit + $ hg log --graph + @ changeset: 5:853c68da763f + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 4:26f6a030ae82 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 3:b069cc29fb22 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +put things back + + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 853c68da763f d + > pick b069cc29fb22 e + > pick 26f6a030ae82 f + > EOF + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg log --graph + @ changeset: 5:652413bf663e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +slightly different this time + + $ cat > $EDITED <<EOF + > pick 055a42cdd887 d + > pick 652413bf663e f + > pick e860deea161a e + > pick 177f92b77385 c + > EOF + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg log --graph + @ changeset: 5:99a62755c625 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 4:7c6fdd608667 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:c4f52e213402 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 2:bfe4a5a76b37 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +keep prevents stripping dead revs + $ cat > $EDITED <<EOF + > pick bfe4a5a76b37 d + > pick c4f52e213402 f + > pick 99a62755c625 c + > pick 7c6fdd608667 e + > EOF + $ HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg log --graph + > cat > $EDITED <<EOF + > pick 7c6fdd608667 e + > pick 99a62755c625 c + > EOF + @ changeset: 7:99e266581538 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 6:5ad36efb0653 + | parent: 3:c4f52e213402 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + | o changeset: 5:99a62755c625 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: c + | | + | o changeset: 4:7c6fdd608667 + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:c4f52e213402 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 2:bfe4a5a76b37 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +try with --rev + $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle + abort: may not use changesets other than the ones listed + $ hg log --graph + @ changeset: 7:99e266581538 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 6:5ad36efb0653 + | parent: 3:c4f52e213402 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + | o changeset: 5:99a62755c625 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: c + | | + | o changeset: 4:7c6fdd608667 + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:c4f52e213402 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 2:bfe4a5a76b37 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +should also work if a commit message is missing + $ BUNDLE="$TESTDIR/missing-comment.hg" + $ hg init missing + $ cd missing + $ hg unbundle $BUNDLE + adding changesets + adding manifests + adding file changes + added 3 changesets with 3 changes to 1 files + (run 'hg update' to get a working copy) + $ hg co tip + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg log --graph + @ changeset: 2:bd22688093b3 + | tag: tip + | user: Robert Altman <robert.altman@telventDTN.com> + | date: Mon Nov 28 16:40:04 2011 +0000 + | summary: Update file. + | + o changeset: 1:3b3e956f9171 + | user: Robert Altman <robert.altman@telventDTN.com> + | date: Mon Nov 28 16:37:57 2011 +0000 + | + o changeset: 0:141947992243 + user: Robert Altman <robert.altman@telventDTN.com> + date: Mon Nov 28 16:35:28 2011 +0000 + summary: Checked in text file + + $ hg histedit 0 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ..
--- a/tests/test-histedit-drop Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -drop 177f92b77385 c -pick e860deea161a e -pick 652413bf663e f -pick 055a42cdd887 d -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % log after edit -hg log --graph - -echo % manifest after edit -hg manifest - -echo % EOF
--- a/tests/test-histedit-drop.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -% log before edit -@ changeset: 5:652413bf663e -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 4 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after edit -@ changeset: 4:708943196e52 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 3:75cbdffecadb -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 2:493dc0964412 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% manifest after edit -a -b -d -e -f -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-drop.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,107 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > drop 177f92b77385 c + > pick e860deea161a e + > pick 652413bf663e f + > pick 055a42cdd887 d + > EOF + $ initrepo () + > { + > hg init r + > cd r + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > } + + $ initrepo + +log before edit + $ hg log --graph + @ changeset: 5:652413bf663e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +log after edit + $ hg log --graph + @ changeset: 4:708943196e52 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 3:75cbdffecadb + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 2:493dc0964412 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +manifest after edit + $ hg manifest + a + b + d + e + f + + $ cd ..
--- a/tests/test-histedit-edit Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 055a42cdd887 d -edit e860deea161a e -pick 652413bf663e f -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % commit, then edit the revision -hg ci -m 'wat' -echo a > e -HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle - -hg log --graph - -echo '% contents of e:' -hg cat e - -cat > $EDITED <<EOF -edit bf757c081cd0 f -EOF -HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle -hg status -HGEDITOR='true' hg histedit --continue -hg status - -echo % log after edit -hg log --limit 1 - -echo "% say we'll change the message, but don't." -cat > ../edit.sh <<EOF -#!/bin/sh -cat \$1 | sed s/pick/mess/ > tmp -mv tmp \$1 -EOF -chmod +x ../edit.sh -HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle -hg status -hg log --limit 1 - -echo % modify the message -cat > $EDITED <<EOF -mess bf757c081cd0 f -EOF -HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle -hg status -hg log --limit 1 - -echo % rollback should not work after a histedit -hg rollback - -echo % EOF
--- a/tests/test-histedit-edit.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -% log before edit -@ changeset: 5:652413bf663e -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -abort: Make changes as needed, you may commit or record as needed now. -When you are finished, run hg histedit --continue to resume. -% commit, then edit the revision -created new head -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 6:bf757c081cd0 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 5:d6b15fed32d4 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: foobaz -| -o changeset: 4:1a60820cd1f6 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: wat -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% contents of e: -a -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -abort: Make changes as needed, you may commit or record as needed now. -When you are finished, run hg histedit --continue to resume. -A f -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after edit -changeset: 6:bf757c081cd0 -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: f - -% say we'll change the message, but don't. -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -changeset: 6:bf757c081cd0 -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: f - -% modify the message -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -changeset: 6:0b16746f8e89 -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: mess bf757c081cd0 f - -% rollback should not work after a histedit -no rollback information available -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-edit.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,180 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 055a42cdd887 d + > edit e860deea161a e + > pick 652413bf663e f + > EOF + $ initrepo () + > { + > hg init r + > cd r + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > } + + $ initrepo + +log before edit + $ hg log --graph + @ changeset: 5:652413bf663e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + abort: Make changes as needed, you may commit or record as needed now. + When you are finished, run hg histedit --continue to resume. + +commit, then edit the revision + $ hg ci -m 'wat' + created new head + $ echo a > e + $ HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg log --graph + @ changeset: 6:bf757c081cd0 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 5:d6b15fed32d4 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: foobaz + | + o changeset: 4:1a60820cd1f6 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: wat + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + + $ hg cat e + a + + $ cat > $EDITED <<EOF + > edit bf757c081cd0 f + > EOF + $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + abort: Make changes as needed, you may commit or record as needed now. + When you are finished, run hg histedit --continue to resume. + $ hg status + A f + $ HGEDITOR='true' hg histedit --continue + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status + +log after edit + $ hg log --limit 1 + changeset: 6:bf757c081cd0 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: f + + +say we'll change the message, but don't. + $ cat > ../edit.sh <<EOF + > #!/bin/sh + > cat \$1 | sed s/pick/mess/ > tmp + > mv tmp \$1 + > EOF + $ chmod +x ../edit.sh + $ HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status + $ hg log --limit 1 + changeset: 6:bf757c081cd0 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: f + + +modify the message + $ cat > $EDITED <<EOF + > mess bf757c081cd0 f + > EOF + $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status + $ hg log --limit 1 + changeset: 6:0b16746f8e89 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: mess bf757c081cd0 f + + +rollback should not work after a histedit + $ hg rollback + no rollback information available + [1] + + $ cd ..
--- a/tests/test-histedit-fold Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick e860deea161a e -pick 652413bf663e f -fold 177f92b77385 c -pick 055a42cdd887 d -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % log after edit -hg log --graph - -echo % post-fold manifest -hg manifest - -echo % EOF
--- a/tests/test-histedit-fold-non-commute Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 055a42cdd887 d -fold bfa474341cc9 does not commute with e -pick e860deea161a e -pick 652413bf663e f -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done - echo a >> e - hg ci -m 'does not commute with e' -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % fix up -echo a > e -hg add e -cat > cat.py <<EOF -import sys -print open(sys.argv[1]).read() -print -print -EOF -HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed' - -echo -echo % just continue this time -hg histedit --continue 2>&1 | fixbundle - - -echo % log after edit -hg log --graph - -echo % contents of e -hg cat e - -echo % manifest -hg manifest - -echo % EOF
--- a/tests/test-histedit-fold-non-commute.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -% log before edit -@ changeset: 6:bfa474341cc9 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 5:652413bf663e -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% fix up -d -*** -does not commute with e - - -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -file e already exists -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue - -% just continue this time -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after edit -@ changeset: 4:f768fd60ca34 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 3:671efe372e33 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% contents of e -a -% manifest -a -b -c -d -e -f -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-fold-non-commute.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,146 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 055a42cdd887 d + > fold bfa474341cc9 does not commute with e + > pick e860deea161a e + > pick 652413bf663e f + > EOF + $ initrepo () + > { + > hg init $1 + > cd $1 + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > echo a >> e + > hg ci -m 'does not commute with e' + > cd .. + > } + + $ initrepo r + $ cd r + +log before edit + $ hg log --graph + @ changeset: 6:bfa474341cc9 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 5:652413bf663e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +fix up + $ echo a > e + $ hg add e + $ cat > cat.py <<EOF + > import sys + > print open(sys.argv[1]).read() + > print + > print + > EOF + $ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed' + d + *** + does not commute with e + + + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + file e already exists + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +just continue this time + $ hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +log after edit + $ hg log --graph + @ changeset: 4:f768fd60ca34 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 3:671efe372e33 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +contents of e + $ hg cat e + a + +manifest + $ hg manifest + a + b + c + d + e + f + + $ cd ..
--- a/tests/test-histedit-fold.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -% log before edit -@ changeset: 5:652413bf663e -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 4 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after edit -@ changeset: 4:82b0c1ff1777 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 3:150aafb44a91 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: pick e860deea161a e -| -o changeset: 2:493dc0964412 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% post-fold manifest -a -b -c -d -e -f -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-fold.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,110 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick e860deea161a e + > pick 652413bf663e f + > fold 177f92b77385 c + > pick 055a42cdd887 d + > EOF + $ initrepo () + > { + > hg init r + > cd r + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > } + + $ initrepo + +log before edit + $ hg log --graph + @ changeset: 5:652413bf663e + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +log after edit + $ hg log --graph + @ changeset: 4:82b0c1ff1777 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 3:150aafb44a91 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: pick e860deea161a e + | + o changeset: 2:493dc0964412 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +post-fold manifest + $ hg manifest + a + b + c + d + e + f + + $ cd ..
--- a/tests/test-histedit-no-change Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -#!/bin/sh - -# test for issue #6: -# editing a changeset without any actual change would corrupt the repository - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -initrepo () -{ - dir="$1" - comment="$2" - - if [ -n "${comment}" ]; then - echo % ${comment} - echo % ${comment} | sed 's:.:-:g' - fi - - hg init ${dir} - cd ${dir} - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done -} - -geneditor () -{ - # generate an editor script for selecting changesets to be edited - - choice=$1 # changesets that should be edited (using sed line ranges) - - cat <<EOF | sed 's:^....::' - #!/bin/sh - - # editing the rules, replacing 'pick' with 'edit' for the chosen lines - sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp - mv \${1}.tmp \$1 - - # displaying the resulting rules, minus comments and empty lines - sed '/^#/d;/^$/d;s:^:| :' \$1 >&2 -EOF -} - -startediting () -{ - # begin an editing session - - choice="$1" # changesets that should be edited - number="$2" # number of changesets considered (from tip) - comment="$3" - - geneditor "${choice}" > edit.sh - chmod +x edit.sh - - echo % start editing the history ${comment} - HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle -} - -continueediting () -{ - # continue an edit already in progress - - editor="$1" # message editor when finalizing editing - comment="$2" - - echo % finalize changeset editing ${comment} - HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle -} - -graphlog () -{ - comment="${1:-log}" - - echo % "${comment}" - hg glog --template '{rev} {node} \"{desc|firstline}\"\n' -} - - - -initrepo r1 "test editing with no change" -graphlog "log before editing" -startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets -continueediting true "(leaving commit message unaltered)" - -echo "% check state of working copy" -hg id - -graphlog "log after history editing" - - -cd .. -initrepo r2 "test editing with no change, then abort" -graphlog "log before editing" -startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets -continueediting true "(leaving commit message unaltered)" -graphlog "log after first edit" - -echo % abort editing session -hg histedit --abort 2>&1 | fixbundle - -graphlog "log after abort" - -echo % EOF
--- a/tests/test-histedit-no-change.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -% test editing with no change ------------------------------ -% log before editing -@ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" -| -o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" -| -o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" -| -o 2 177f92b773850b59254aa5e923436f921b55483b "c" -| -o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" -| -o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" - -% start editing the history (not changing anything) -| pick 055a42cdd887 3 d -| edit e860deea161a 4 e -| pick 652413bf663e 5 f -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -abort: Make changes as needed, you may commit or record as needed now. -When you are finished, run hg histedit --continue to resume. -% finalize changeset editing (leaving commit message unaltered) -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% check state of working copy -652413bf663e tip -% log after history editing -@ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" -| -o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" -| -o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" -| -o 2 177f92b773850b59254aa5e923436f921b55483b "c" -| -o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" -| -o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" - -% test editing with no change, then abort ------------------------------------------ -% log before editing -@ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" -| -o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" -| -o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" -| -o 2 177f92b773850b59254aa5e923436f921b55483b "c" -| -o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" -| -o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" - -% start editing the history (not changing anything) -| edit 055a42cdd887 3 d -| edit e860deea161a 4 e -| pick 652413bf663e 5 f -0 files updated, 0 files merged, 3 files removed, 0 files unresolved -abort: Make changes as needed, you may commit or record as needed now. -When you are finished, run hg histedit --continue to resume. -% finalize changeset editing (leaving commit message unaltered) -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -abort: Make changes as needed, you may commit or record as needed now. -When you are finished, run hg histedit --continue to resume. -% log after first edit -o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" -| -o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" -| -@ 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" -| -o 2 177f92b773850b59254aa5e923436f921b55483b "c" -| -o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" -| -o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" - -% abort editing session -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after abort -@ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" -| -o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" -| -o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" -| -o 2 177f92b773850b59254aa5e923436f921b55483b "c" -| -o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" -| -o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" - -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-no-change.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,189 @@ +test for old histedit issue #6: +editing a changeset without any actual change would corrupt the repository + + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ initrepo () + > { + > dir="$1" + > comment="$2" + > if [ -n "${comment}" ]; then + > echo % ${comment} + > echo % ${comment} | sed 's:.:-:g' + > fi + > hg init ${dir} + > cd ${dir} + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > cd .. + > } + + $ geneditor () + > { + > # generate an editor script for selecting changesets to be edited + > choice=$1 # changesets that should be edited (using sed line ranges) + > cat <<EOF | sed 's:^....::' + > #!/bin/sh + > # editing the rules, replacing 'pick' with 'edit' for the chosen lines + > sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp + > mv \${1}.tmp \$1 + > # displaying the resulting rules, minus comments and empty lines + > sed '/^#/d;/^$/d;s:^:| :' \$1 >&2 + > EOF + > } + + $ startediting () + > { + > # begin an editing session + > choice="$1" # changesets that should be edited + > number="$2" # number of changesets considered (from tip) + > comment="$3" + > geneditor "${choice}" > edit.sh + > chmod +x edit.sh + > echo % start editing the history ${comment} + > HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle + > } + + $ continueediting () + > { + > # continue an edit already in progress + > editor="$1" # message editor when finalizing editing + > comment="$2" + > echo % finalize changeset editing ${comment} + > HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle + > } + + $ graphlog () + > { + > comment="${1:-log}" + > echo % "${comment}" + > hg glog --template '{rev} {node} \"{desc|firstline}\"\n' + > } + + + $ initrepo r1 "test editing with no change" + % test editing with no change + ----------------------------- + $ cd r1 + $ graphlog "log before editing" + % log before editing + @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" + | + o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" + | + o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" + | + o 2 177f92b773850b59254aa5e923436f921b55483b "c" + | + o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" + | + o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" + + $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets + % start editing the history (not changing anything) + | pick 055a42cdd887 3 d + | edit e860deea161a 4 e + | pick 652413bf663e 5 f + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + abort: Make changes as needed, you may commit or record as needed now. + When you are finished, run hg histedit --continue to resume. + $ continueediting true "(leaving commit message unaltered)" + % finalize changeset editing (leaving commit message unaltered) + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +check state of working copy + $ hg id + 652413bf663e tip + + $ graphlog "log after history editing" + % log after history editing + @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" + | + o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" + | + o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" + | + o 2 177f92b773850b59254aa5e923436f921b55483b "c" + | + o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" + | + o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" + + + $ cd .. + + $ initrepo r2 "test editing with no change, then abort" + % test editing with no change, then abort + ----------------------------------------- + $ cd r2 + $ graphlog "log before editing" + % log before editing + @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" + | + o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" + | + o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" + | + o 2 177f92b773850b59254aa5e923436f921b55483b "c" + | + o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" + | + o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" + + $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets + % start editing the history (not changing anything) + | edit 055a42cdd887 3 d + | edit e860deea161a 4 e + | pick 652413bf663e 5 f + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + abort: Make changes as needed, you may commit or record as needed now. + When you are finished, run hg histedit --continue to resume. + $ continueediting true "(leaving commit message unaltered)" + % finalize changeset editing (leaving commit message unaltered) + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + abort: Make changes as needed, you may commit or record as needed now. + When you are finished, run hg histedit --continue to resume. + $ graphlog "log after first edit" + % log after first edit + o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" + | + o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" + | + @ 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" + | + o 2 177f92b773850b59254aa5e923436f921b55483b "c" + | + o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" + | + o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" + + +abort editing session + $ hg histedit --abort 2>&1 | fixbundle + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ graphlog "log after abort" + % log after abort + @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f" + | + o 4 e860deea161a2f77de56603b340ebbb4536308ae "e" + | + o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d" + | + o 2 177f92b773850b59254aa5e923436f921b55483b "c" + | + o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b" + | + o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a" + + + $ cd ..
--- a/tests/test-histedit-non-commute Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 055a42cdd887 d -pick bfa474341cc9 does not commute with e -pick e860deea161a e -pick 652413bf663e f -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done - echo a >> e - hg ci -m 'does not commute with e' -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % abort the edit -hg histedit --abort 2>&1 | fixbundle - -echo -echo -echo % second edit set - -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo % fix up -echo a > e -hg add e -hg histedit --continue 2>&1 | fixbundle - -echo -echo % just continue this time -hg histedit --continue 2>&1 | fixbundle - -echo % log after edit -hg log --graph - -echo % start over - -cd .. -rm -r r -initrepo -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 055a42cdd887 d -mess bfa474341cc9 does not commute with e -pick e860deea161a e -pick 652413bf663e f -EOF - -echo % edit the history, this time with a fold action -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo -echo a > e -hg add e -HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle -echo % second edit also fails, but just continue -hg histedit --continue 2>&1 | fixbundle - -echo % post message fix -hg log --graph - -echo % EOF
--- a/tests/test-histedit-non-commute-abort Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#!/bin/sh - -. "$TESTDIR/histedit-helpers.sh" - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick 055a42cdd887 d -pick bfa474341cc9 does not commute with e -pick e860deea161a e -pick 652413bf663e f -EOF -initrepo () -{ - hg init r - cd r - for x in a b c d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done - echo a >> e - hg ci -m 'does not commute with e' -} - -initrepo - -echo % log before edit -hg log --graph - -echo % edit the history -HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle - -echo '% fix up (pre abort)' -echo a > e -hg add e -hg histedit --continue 2>&1 | fixbundle - -echo % abort the edit -hg histedit --abort 2>&1 | fixbundle - -echo % log after abort -hg log --graph -echo % EOF
--- a/tests/test-histedit-non-commute-abort.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -% log before edit -@ changeset: 6:bfa474341cc9 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 5:652413bf663e -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% fix up (pre abort) -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -file e already exists -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% abort the edit -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after abort -@ changeset: 6:bfa474341cc9 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 5:652413bf663e -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-non-commute-abort.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,131 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 055a42cdd887 d + > pick bfa474341cc9 does not commute with e + > pick e860deea161a e + > pick 652413bf663e f + > EOF + $ initrepo () + > { + > hg init r + > cd r + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > echo a >> e + > hg ci -m 'does not commute with e' + > cd .. + > } + + $ initrepo + $ cd r + +log before edit + $ hg log --graph + @ changeset: 6:bfa474341cc9 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 5:652413bf663e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +fix up (pre abort) + $ echo a > e + $ hg add e + $ hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + file e already exists + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +abort the edit + $ hg histedit --abort 2>&1 | fixbundle + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +log after abort + $ hg log --graph + @ changeset: 6:bfa474341cc9 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 5:652413bf663e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + + $ cd ..
--- a/tests/test-histedit-non-commute.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -% log before edit -@ changeset: 6:bfa474341cc9 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 5:652413bf663e -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% abort the edit -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - - -% second edit set -@ changeset: 6:bfa474341cc9 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 5:652413bf663e -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:e860deea161a -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% edit the history -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% fix up -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -file e already exists -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue - -% just continue this time -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% log after edit -@ changeset: 5:9ab84894b459 -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:1fff3ae8199d -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: does not commute with e -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% start over -% edit the history, this time with a fold action -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue - -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -file e already exists -1 out of 1 hunks FAILED -- saving rejects to file e.rej -abort: Fix up the change and run hg histedit --continue -% second edit also fails, but just continue -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% post message fix -@ changeset: 5:6459970fb49b -| tag: tip -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: f -| -o changeset: 4:556f27c874b0 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: pick 177f92b77385 c -| -o changeset: 3:055a42cdd887 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: d -| -o changeset: 2:177f92b77385 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: c -| -o changeset: 1:d2ae7f538514 -| user: test -| date: Thu Jan 01 00:00:00 1970 +0000 -| summary: b -| -o changeset: 0:cb9a9f314b8b - user: test - date: Thu Jan 01 00:00:00 1970 +0000 - summary: a - -% EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-non-commute.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,244 @@ + $ . "$TESTDIR/histedit-helpers.sh" + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 055a42cdd887 d + > pick bfa474341cc9 does not commute with e + > pick e860deea161a e + > pick 652413bf663e f + > EOF + $ initrepo () + > { + > hg init $1 + > cd $1 + > for x in a b c d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > echo a >> e + > hg ci -m 'does not commute with e' + > cd .. + > } + + $ initrepo r1 + $ cd r1 + +log before edit + $ hg log --graph + @ changeset: 6:bfa474341cc9 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 5:652413bf663e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +abort the edit + $ hg histedit --abort 2>&1 | fixbundle + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + + +second edit set + + $ hg log --graph + @ changeset: 6:bfa474341cc9 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 5:652413bf663e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:e860deea161a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +edit the history + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +fix up + $ echo a > e + $ hg add e + $ hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + file e already exists + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + +just continue this time + $ hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +log after edit + $ hg log --graph + @ changeset: 5:9ab84894b459 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:1fff3ae8199d + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: does not commute with e + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + +start over + + $ cd .. + + $ initrepo r2 + $ cd r2 + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick 055a42cdd887 d + > mess bfa474341cc9 does not commute with e + > pick e860deea161a e + > pick 652413bf663e f + > EOF + +edit the history, this time with a fold action + $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue + + $ echo a > e + $ hg add e + $ HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + file e already exists + 1 out of 1 hunks FAILED -- saving rejects to file e.rej + abort: Fix up the change and run hg histedit --continue +second edit also fails, but just continue + $ hg histedit --continue 2>&1 | fixbundle + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +post message fix + $ hg log --graph + @ changeset: 5:6459970fb49b + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: f + | + o changeset: 4:556f27c874b0 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: pick 177f92b77385 c + | + o changeset: 3:055a42cdd887 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: d + | + o changeset: 2:177f92b77385 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: c + | + o changeset: 1:d2ae7f538514 + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: b + | + o changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + + $ cd ..
--- a/tests/test-histedit-outgoing Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -#!/bin/sh - -cat >> $HGRCPATH <<EOF -[extensions] -graphlog= -histedit= -EOF - -EDITED=`pwd`/editedhistory -cat > $EDITED <<EOF -pick 177f92b77385 c -pick e860deea161a e -pick 652413bf663e f -pick 055a42cdd887 d -EOF -initrepo () -{ - hg init r - cd r - for x in a b c ; do - echo $x > $x - hg add $x - hg ci -m $x - done - - cd .. - hg clone r r2 | grep -v updating - cd r2 - for x in d e f ; do - echo $x > $x - hg add $x - hg ci -m $x - done - - cd .. - hg init r3 - cd r3 - for x in g h i ; do - echo $x > $x - hg add $x - hg ci -m $x - done - cd .. -} - -initrepo - -echo % show the edit commands offered by outgoing -cd r2 -HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching -cd .. - -echo % show the error from unrelated repos -cd r3 -HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching -cd .. - -echo % show the error from unrelated repos -cd r3 -HGEDITOR=cat hg histedit --force --outgoing ../r -cd ..
--- a/tests/test-histedit-outgoing.out Sat Jun 30 03:34:41 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -% show the edit commands offered by outgoing -pick 055a42cdd887 3 d -pick e860deea161a 4 e -pick 652413bf663e 5 f - -# Edit history between 055a42cdd887 and 652413bf663e -# -# Commands: -# p, pick = use commit -# e, edit = use commit, but stop for amending -# f, fold = use commit, but fold into previous commit (combines N and N-1) -# d, drop = remove commit from history -# m, mess = edit message without changing commit content -# -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% show the error from unrelated repos -abort: repository is unrelated -% show the error from unrelated repos -comparing with ../r -searching for changes -warning: repository is unrelated -pick 2a4042b45417 0 g -pick 68c46b4927ce 1 h -pick 51281e65ba79 2 i - -# Edit history between 2a4042b45417 and 51281e65ba79 -# -# Commands: -# p, pick = use commit -# e, edit = use commit, but stop for amending -# f, fold = use commit, but fold into previous commit (combines N and N-1) -# d, drop = remove commit from history -# m, mess = edit message without changing commit content -# -0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-histedit-outgoing.t Sat Jun 30 03:34:44 2012 +0200 @@ -0,0 +1,91 @@ + $ cat >> $HGRCPATH <<EOF + > [extensions] + > graphlog= + > histedit= + > EOF + + $ EDITED=`pwd`/editedhistory + $ cat > $EDITED <<EOF + > pick 177f92b77385 c + > pick e860deea161a e + > pick 652413bf663e f + > pick 055a42cdd887 d + > EOF + $ initrepos () + > { + > hg init r + > cd r + > for x in a b c ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > cd .. + > hg clone r r2 | grep -v updating + > cd r2 + > for x in d e f ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > cd .. + > hg init r3 + > cd r3 + > for x in g h i ; do + > echo $x > $x + > hg add $x + > hg ci -m $x + > done + > cd .. + > } + + $ initrepos + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +show the edit commands offered by outgoing + $ cd r2 + $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching + pick 055a42cdd887 3 d + pick e860deea161a 4 e + pick 652413bf663e 5 f + + # Edit history between 055a42cdd887 and 652413bf663e + # + # Commands: + # p, pick = use commit + # e, edit = use commit, but stop for amending + # f, fold = use commit, but fold into previous commit (combines N and N-1) + # d, drop = remove commit from history + # m, mess = edit message without changing commit content + # + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd .. + +show the error from unrelated repos + $ cd r3 + $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching + abort: repository is unrelated + [1] + $ cd .. + +show the error from unrelated repos + $ cd r3 + $ HGEDITOR=cat hg histedit --force --outgoing ../r + comparing with ../r + searching for changes + warning: repository is unrelated + pick 2a4042b45417 0 g + pick 68c46b4927ce 1 h + pick 51281e65ba79 2 i + + # Edit history between 2a4042b45417 and 51281e65ba79 + # + # Commands: + # p, pick = use commit + # e, edit = use commit, but stop for amending + # f, fold = use commit, but fold into previous commit (combines N and N-1) + # d, drop = remove commit from history + # m, mess = edit message without changing commit content + # + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ..