2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2012-06-30 05:34:44 +04:00
|
|
|
$ . "$TESTDIR/histedit-helpers.sh"
|
|
|
|
|
2020-01-20 13:42:49 +03:00
|
|
|
$ enable histedit
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
$ initrepo ()
|
|
|
|
> {
|
|
|
|
> hg init $1
|
|
|
|
> cd $1
|
|
|
|
> for x in a b c d e f ; do
|
2012-09-21 21:13:25 +04:00
|
|
|
> echo $x$x$x$x$x > $x
|
2012-06-30 05:34:44 +04:00
|
|
|
> hg add $x
|
2012-09-21 21:13:25 +04:00
|
|
|
> done
|
|
|
|
> hg ci -m 'Initial commit'
|
|
|
|
> for x in a b c d e f ; do
|
|
|
|
> echo $x > $x
|
2012-06-30 05:34:44 +04:00
|
|
|
> hg ci -m $x
|
|
|
|
> done
|
2012-09-21 21:13:25 +04:00
|
|
|
> echo 'I can haz no commute' > e
|
2012-06-30 05:34:44 +04:00
|
|
|
> hg ci -m 'does not commute with e'
|
|
|
|
> cd ..
|
|
|
|
> }
|
|
|
|
|
|
|
|
$ initrepo r1
|
|
|
|
$ cd r1
|
|
|
|
|
2012-09-21 21:13:25 +04:00
|
|
|
Initial generation of the command files
|
|
|
|
|
|
|
|
$ EDITED="$TESTTMP/editedhistory"
|
2020-10-08 06:58:22 +03:00
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 65a9a84f33fdeb1ad5679b3941ec885d2b24027b >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 00f1c53839651fa5c76d423606811ea5455a79d0 >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 'desc(does)' >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 7b4e2f4b7bcd98ffe5ea672d73b0a7bf7233f9f7 >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 'desc(f)' >> $EDITED
|
2012-09-21 21:13:25 +04:00
|
|
|
$ cat $EDITED
|
2020-10-08 06:58:22 +03:00
|
|
|
pick 65a9a84f33fd c
|
|
|
|
pick 00f1c5383965 d
|
|
|
|
pick 39522b764e3d does not commute with e
|
|
|
|
pick 7b4e2f4b7bcd e
|
|
|
|
pick 500cac37a696 f
|
2012-09-21 21:13:25 +04:00
|
|
|
|
2012-06-30 05:34:44 +04:00
|
|
|
log before edit
|
|
|
|
$ hg log --graph
|
2020-07-21 03:23:52 +03:00
|
|
|
@ commit: 39522b764e3d
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: does not commute with e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 500cac37a696
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: f
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 7b4e2f4b7bcd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 00f1c5383965
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: d
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 65a9a84f33fd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: c
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: da6535b52e45
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: b
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: c1f09da44841
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: a
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 1715188a53c7
|
2012-06-30 05:34:44 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2012-09-21 21:13:25 +04:00
|
|
|
summary: Initial commit
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
edit the history
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg histedit 65a9a84f33fdeb1ad5679b3941ec885d2b24027b --commands $EDITED 2>&1 | fixbundle
|
2012-09-21 21:13:25 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-09-21 21:27:22 +04:00
|
|
|
merging e
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging e! (edit, then use 'hg resolve --mark')
|
2015-12-23 11:57:04 +03:00
|
|
|
Fix up the change (pick 39522b764e3d)
|
|
|
|
(hg histedit --continue to resume)
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
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
|
2020-07-21 03:23:52 +03:00
|
|
|
@ commit: 39522b764e3d
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: does not commute with e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 500cac37a696
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: f
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 7b4e2f4b7bcd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 00f1c5383965
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: d
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 65a9a84f33fd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: c
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: da6535b52e45
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: b
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: c1f09da44841
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: a
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 1715188a53c7
|
2012-06-30 05:34:44 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2012-09-21 21:13:25 +04:00
|
|
|
summary: Initial commit
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
edit the history
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg histedit 65a9a84f33fdeb1ad5679b3941ec885d2b24027b --commands $EDITED 2>&1 | fixbundle
|
2012-09-21 21:13:25 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-09-21 21:27:22 +04:00
|
|
|
merging e
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging e! (edit, then use 'hg resolve --mark')
|
2015-12-23 11:57:04 +03:00
|
|
|
Fix up the change (pick 39522b764e3d)
|
|
|
|
(hg histedit --continue to resume)
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
fix up
|
2012-09-21 21:13:25 +04:00
|
|
|
$ echo 'I can haz no commute' > e
|
2012-09-21 21:27:22 +04:00
|
|
|
$ hg resolve --mark e
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2015-12-24 23:41:17 +03:00
|
|
|
continue: hg histedit --continue
|
2012-06-30 05:34:44 +04:00
|
|
|
$ hg histedit --continue 2>&1 | fixbundle
|
2012-09-21 21:27:22 +04:00
|
|
|
merging e
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging e! (edit, then use 'hg resolve --mark')
|
2015-12-23 11:57:04 +03:00
|
|
|
Fix up the change (pick 7b4e2f4b7bcd)
|
|
|
|
(hg histedit --continue to resume)
|
2017-04-21 03:18:08 +03:00
|
|
|
$ hg histedit --continue 2>&1 | fixbundle
|
|
|
|
abort: unresolved merge conflicts (see 'hg help resolve')
|
2012-06-30 05:34:44 +04:00
|
|
|
|
2012-09-27 03:53:28 +04:00
|
|
|
This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
|
|
|
|
former children.
|
|
|
|
|
2012-06-30 05:34:44 +04:00
|
|
|
just continue this time
|
2012-09-21 21:27:22 +04:00
|
|
|
$ hg revert -r 'p1()' e
|
2017-04-21 03:18:08 +03:00
|
|
|
make sure the to-be-empty commit doesn't screw up the state (issue5545)
|
|
|
|
$ hg histedit --continue 2>&1 | fixbundle
|
|
|
|
abort: unresolved merge conflicts (see 'hg help resolve')
|
2012-09-21 21:27:22 +04:00
|
|
|
$ hg resolve --mark e
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2015-12-24 23:41:17 +03:00
|
|
|
continue: hg histedit --continue
|
2012-06-30 05:34:44 +04:00
|
|
|
$ hg histedit --continue 2>&1 | fixbundle
|
2016-03-03 01:39:03 +03:00
|
|
|
7b4e2f4b7bcd: skipping changeset (no changes)
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
log after edit
|
|
|
|
$ hg log --graph
|
2020-07-21 03:23:52 +03:00
|
|
|
@ commit: 7efe1373e4bc
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: f
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: e334d87a1e55
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: does not commute with e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 00f1c5383965
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: d
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 65a9a84f33fd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: c
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: da6535b52e45
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: b
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: c1f09da44841
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: a
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 1715188a53c7
|
2012-06-30 05:34:44 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2012-09-21 21:13:25 +04:00
|
|
|
summary: Initial commit
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
start over
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ initrepo r2
|
|
|
|
$ cd r2
|
2012-09-21 21:13:25 +04:00
|
|
|
$ rm $EDITED
|
2020-10-08 06:58:22 +03:00
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 65a9a84f33fdeb1ad5679b3941ec885d2b24027b >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 00f1c53839651fa5c76d423606811ea5455a79d0 >> $EDITED
|
|
|
|
$ hg log --template 'mess {node|short} {desc}\n' -r 'desc(does)' >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 7b4e2f4b7bcd98ffe5ea672d73b0a7bf7233f9f7 >> $EDITED
|
|
|
|
$ hg log --template 'pick {node|short} {desc}\n' -r 'desc(f)' >> $EDITED
|
2012-09-21 21:13:25 +04:00
|
|
|
$ cat $EDITED
|
2020-10-08 06:58:22 +03:00
|
|
|
pick 65a9a84f33fd c
|
|
|
|
pick 00f1c5383965 d
|
|
|
|
mess 39522b764e3d does not commute with e
|
|
|
|
pick 7b4e2f4b7bcd e
|
|
|
|
pick 500cac37a696 f
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
edit the history, this time with a fold action
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg histedit 65a9a84f33fdeb1ad5679b3941ec885d2b24027b --commands $EDITED 2>&1 | fixbundle
|
2012-09-21 21:13:25 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-09-21 21:27:22 +04:00
|
|
|
merging e
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging e! (edit, then use 'hg resolve --mark')
|
2015-12-23 11:57:04 +03:00
|
|
|
Fix up the change (mess 39522b764e3d)
|
|
|
|
(hg histedit --continue to resume)
|
2012-06-30 05:34:44 +04:00
|
|
|
|
2012-09-21 21:13:25 +04:00
|
|
|
$ echo 'I can haz no commute' > e
|
2012-09-21 21:27:22 +04:00
|
|
|
$ hg resolve --mark e
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2015-12-24 23:41:17 +03:00
|
|
|
continue: hg histedit --continue
|
2019-10-09 00:18:34 +03:00
|
|
|
$ hg continue 2>&1 | fixbundle
|
2012-09-21 21:27:22 +04:00
|
|
|
merging e
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging e! (edit, then use 'hg resolve --mark')
|
2015-12-23 11:57:04 +03:00
|
|
|
Fix up the change (pick 7b4e2f4b7bcd)
|
|
|
|
(hg histedit --continue to resume)
|
2012-06-30 05:34:44 +04:00
|
|
|
second edit also fails, but just continue
|
2012-09-21 21:27:22 +04:00
|
|
|
$ hg revert -r 'p1()' e
|
|
|
|
$ hg resolve --mark e
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2015-12-24 23:41:17 +03:00
|
|
|
continue: hg histedit --continue
|
2012-06-30 05:34:44 +04:00
|
|
|
$ hg histedit --continue 2>&1 | fixbundle
|
2016-03-03 01:39:03 +03:00
|
|
|
7b4e2f4b7bcd: skipping changeset (no changes)
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
post message fix
|
|
|
|
$ hg log --graph
|
2020-07-21 03:23:52 +03:00
|
|
|
@ commit: 7efe1373e4bc
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: f
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: e334d87a1e55
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: does not commute with e
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 00f1c5383965
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: d
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 65a9a84f33fd
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: c
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: da6535b52e45
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: b
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: c1f09da44841
|
2020-10-20 03:05:23 +03:00
|
|
|
│ user: test
|
|
|
|
│ date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
│ summary: a
|
|
|
|
│
|
2020-07-21 03:23:52 +03:00
|
|
|
o commit: 1715188a53c7
|
2012-06-30 05:34:44 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2012-09-21 21:13:25 +04:00
|
|
|
summary: Initial commit
|
2012-06-30 05:34:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
$ cd ..
|