tests/test-mq-qfold.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 10:14:25 -0700
changeset 21379 ab1a95270a50
parent 21236 49148d7868df
child 21423 7d408720453d
permissions -rw-r--r--
run-tests: move parsehghaveoutput() into TTest This patch starts a sequence of patches that will try to isolate everything related to t tests into the TTest class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     1
  $ echo "[extensions]" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     2
  $ echo "mq=" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     3
  $ echo "[mq]" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     4
  $ echo "git=keep" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     5
  $ echo "[diff]" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     6
  $ echo "nodates=1" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     7
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
     8
init:
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    10
  $ hg init repo
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    11
  $ cd repo
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    12
  $ echo a > a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    13
  $ hg ci -Am adda
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    14
  adding a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    15
  $ echo a >> a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    16
  $ hg qnew -f p1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    17
  $ echo b >> a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    18
  $ hg qnew -f p2
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    19
  $ echo c >> a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    20
  $ hg qnew -f p3
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    21
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    22
Fold in the middle of the queue:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    23
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    24
  $ hg qpop p1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    25
  popping p3
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    26
  popping p2
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    27
  now at: p1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    28
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    29
  $ hg qdiff
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    30
  diff -r 07f494440405 a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    31
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    32
  +++ b/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    33
  @@ -1,1 +1,2 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    34
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    35
  +a
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    37
  $ hg qfold p2
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    38
  $ grep git .hg/patches/p1 && echo 'git patch found!'
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    39
  [1]
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    40
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    41
  $ hg qser
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    42
  p1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    43
  p3
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    44
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    45
  $ hg qdiff
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    46
  diff -r 07f494440405 a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    47
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    48
  +++ b/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    49
  @@ -1,1 +1,3 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    50
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    51
  +a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    52
  +b
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    54
Fold with local changes:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    55
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    56
  $ echo d >> a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    57
  $ hg qfold p3
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    58
  abort: local changes found, refresh first
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    59
  [255]
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    60
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    61
  $ hg diff -c .
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
    62
  diff -r 07f494440405 -r ???????????? a (glob)
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    63
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    64
  +++ b/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    65
  @@ -1,1 +1,3 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    66
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    67
  +a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    68
  +b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    69
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    70
  $ hg revert -a --no-backup
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    71
  reverting a
10397
8cb81d75730c mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents: 10190
diff changeset
    72
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    73
Fold git patch into a regular patch, expect git patch:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    74
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    75
  $ echo a >> a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    76
  $ hg qnew -f regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    77
  $ hg cp a aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    78
  $ hg qnew --git -f git
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    79
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    80
  $ hg qpop
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    81
  popping git
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    82
  now at: regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    83
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    84
  $ hg qfold git
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    85
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    86
  $ cat .hg/patches/regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    87
  # HG changeset patch
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
    88
  # Parent ???????????????????????????????????????? (glob)
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    89
  
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    90
  diff --git a/a b/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    91
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    92
  +++ b/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    93
  @@ -1,3 +1,4 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    94
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    95
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    96
   b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    97
  +a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    98
  diff --git a/a b/aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
    99
  copy from a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   100
  copy to aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   101
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   102
  +++ b/aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   103
  @@ -1,3 +1,4 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   104
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   105
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   106
   b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   107
  +a
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
   108
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   109
  $ hg qpop
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   110
  popping regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   111
  now at: p1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   112
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   113
  $ hg qdel regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   114
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   115
Fold regular patch into a git patch, expect git patch:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   116
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   117
  $ hg cp a aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   118
  $ hg qnew --git -f git
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   119
  $ echo b >> aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   120
  $ hg qnew -f regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   121
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   122
  $ hg qpop
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   123
  popping regular
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   124
  now at: git
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
   125
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   126
  $ hg qfold regular
10186
296a0b14a686 mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents: 8426
diff changeset
   127
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   128
  $ cat .hg/patches/git
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   129
  # HG changeset patch
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   130
  # Parent ???????????????????????????????????????? (glob)
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   131
  
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   132
  diff --git a/a b/aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   133
  copy from a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   134
  copy to aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   135
  --- a/a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   136
  +++ b/aa
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   137
  @@ -1,3 +1,4 @@
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   138
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   139
   a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   140
   b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   141
  +b
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   142
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   143
Test saving last-message.txt:
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   144
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   145
  $ hg qrefresh -m "original message"
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   146
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20769
diff changeset
   147
  $ cat > $TESTTMP/commitfailure.py <<EOF
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   148
  > from mercurial import util
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   149
  > def reposetup(ui, repo):
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   150
  >     class commitfailure(repo.__class__):
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   151
  >         def commit(self, *args, **kwargs):
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   152
  >             raise util.Abort('emulating unexpected abort')
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   153
  >     repo.__class__ = commitfailure
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   154
  > EOF
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   155
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   156
  $ cat >> .hg/hgrc <<EOF
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   157
  > [extensions]
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   158
  > # this failure occurs before editor invocation
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20769
diff changeset
   159
  > commitfailure = $TESTTMP/commitfailure.py
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   160
  > EOF
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   161
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20769
diff changeset
   162
  $ cat > $TESTTMP/editor.sh << EOF
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   163
  > echo "==== before editing"
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   164
  > cat \$1
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   165
  > echo "===="
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   166
  > (echo; echo "test saving last-message.txt") >> \$1
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   167
  > EOF
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   168
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   169
  $ hg qapplied
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   170
  p1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   171
  git
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   172
  $ hg tip --template "{files}\n"
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   173
  aa
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   174
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   175
(test that editor is not invoked before transaction starting)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   176
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   177
  $ rm -f .hg/last-message.txt
20859
e259d4c462b5 tests: use TESTTMP instead of TESTDIR
Sean Farley <sean.michael.farley@gmail.com>
parents: 20769
diff changeset
   178
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   179
  refresh interrupted while patch was popped! (revert --all, qpush to recover)
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   180
  abort: emulating unexpected abort
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   181
  [255]
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   182
  $ cat .hg/last-message.txt
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   183
  cat: .hg/last-message.txt: No such file or directory
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   184
  [1]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   185
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   186
(reset applied patches and directory status)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   187
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   188
  $ cat >> .hg/hgrc <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   189
  > [extensions]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   190
  > # this failure occurs after editor invocation
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   191
  > commitfailure = !
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   192
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   193
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   194
  $ hg qapplied
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   195
  p1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   196
  $ hg status -A aa
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   197
  ? aa
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   198
  $ rm aa
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   199
  $ hg status -m
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   200
  M a
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   201
  $ hg revert --no-backup -q a
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   202
  $ hg qpush -q git
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   203
  now at: git
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   204
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   205
(test that editor is invoked and commit message is saved into
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   206
"last-message.txt")
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   207
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   208
  $ cat >> .hg/hgrc <<EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   209
  > [hooks]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   210
  > # this failure occurs after editor invocation
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   211
  > pretxncommit.unexpectedabort = false
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   212
  > EOF
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   213
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   214
  $ rm -f .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   215
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   216
  ==== before editing
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   217
  original message
21236
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   218
  ====
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   219
  transaction abort!
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   220
  rollback completed
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   221
  note: commit message saved in .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   222
  refresh interrupted while patch was popped! (revert --all, qpush to recover)
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   223
  abort: pretxncommit.unexpectedabort hook exited with status 1
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   224
  [255]
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   225
  $ cat .hg/last-message.txt
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   226
  original message
49148d7868df qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20859
diff changeset
   227
  
20769
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   228
  test saving last-message.txt
1e686e55780c qfold: save manually edited commit message into ".hg/last-message.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 12376
diff changeset
   229
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 10397
diff changeset
   230
  $ cd ..
8426
2ff17c4de1da Add tests for qfold
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   231