Mercurial > hg
annotate tests/test-histedit-no-backup.t @ 41163:0101a35deae2
phabricator: warn if unable to amend, instead of aborting after posting
There was a divergence in behavior here between obsolete and strip based
amending. I first noticed the abort when testing outside of the test harness,
but then had trouble recreating it here after reverting the code changes. It
turns out, strip based amend was successfully amending the public commit after
it was posted! It looks like the protection is in the `commit --amend` command,
not in the underlying code that it calls.
I considered doing a preflight check and aborting. But the locks are only
acquired at the end, if amending, and this is too large a section of code to be
wrapped in a maybe-it's-held-or-not context manager for my tastes.
Additionally, some people do post-push reviews, and amending is the default
behavior, so they shouldn't see a misleading error message.
The lack of a 'Differential Revision' entry in the commit message breaks a
{phabreview} test, so it had to be partially conditionalized.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 05 Jan 2019 15:20:33 -0500 |
parents | faea9b1980d9 |
children | 6acbe86c6490 |
rev | line source |
---|---|
38548
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
1 $ . "$TESTDIR/histedit-helpers.sh" |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
2 |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
3 Enable extension used by this test |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
4 $ cat >>$HGRCPATH <<EOF |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
5 > [extensions] |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
6 > histedit= |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
7 > EOF |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
8 |
38738
faea9b1980d9
histedit: drop --no-backup option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38733
diff
changeset
|
9 ========================================== |
faea9b1980d9
histedit: drop --no-backup option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38733
diff
changeset
|
10 Test history-editing-backup config option| |
faea9b1980d9
histedit: drop --no-backup option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38733
diff
changeset
|
11 ========================================== |
38548
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
12 Repo setup: |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
13 $ hg init foo |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
14 $ cd foo |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
15 $ echo first>file |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
16 $ hg ci -qAm one |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
17 $ echo second>>file |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
18 $ hg ci -m two |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
19 $ echo third>>file |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
20 $ hg ci -m three |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
21 $ echo forth>>file |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
22 $ hg ci -m four |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
23 $ hg log -G --style compact |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
24 @ 3[tip] 7d5187087c79 1970-01-01 00:00 +0000 test |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
25 | four |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
26 | |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
27 o 2 80d23dfa866d 1970-01-01 00:00 +0000 test |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
28 | three |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
29 | |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
30 o 1 6153eb23e623 1970-01-01 00:00 +0000 test |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
31 | two |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
32 | |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
33 o 0 36b4bdd91f5b 1970-01-01 00:00 +0000 test |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
34 one |
7b57b1ed5c0f
histedit: add --no-backup option (issue5825)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff
changeset
|
35 |
38733
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
36 Test when `history-editing-backup` config option is enabled: |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
37 $ hg histedit -r '36b4bdd91f5b' --commands - << EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
38 > pick 36b4bdd91f5b 0 one |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
39 > pick 6153eb23e623 1 two |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
40 > roll 80d23dfa866d 2 three |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
41 > edit 7d5187087c79 3 four |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
42 > EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
43 merging file |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
44 Editing (7d5187087c79), you may commit or record as needed now. |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
45 (hg histedit --continue to resume) |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
46 [1] |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
47 $ hg histedit --abort |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
49 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
50 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
51 |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
52 Test when `history-editing-backup` config option is not enabled |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
53 Enable config option: |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
54 $ cat >>$HGRCPATH <<EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
55 > [ui] |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
56 > history-editing-backup=False |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
57 > EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
58 |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
59 $ hg histedit -r '36b4bdd91f5b' --commands - << EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
60 > pick 36b4bdd91f5b 0 one |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
61 > pick 6153eb23e623 1 two |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
62 > roll 80d23dfa866d 2 three |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
63 > edit 7d5187087c79 3 four |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
64 > EOF |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
65 merging file |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
66 Editing (7d5187087c79), you may commit or record as needed now. |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
67 (hg histedit --continue to resume) |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
68 [1] |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
69 $ hg histedit --abort |
c2586a6e5884
histedit: add history-editing-backup config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
38548
diff
changeset
|
70 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |