This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

test-rebase-transaction.t 3.55 KB
Newer Older
1
#testcases continuecommand continueflag
2 3
Rebasing using a single transaction

4 5 6 7 8
  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > rebase=
  > drawdag=$TESTDIR/drawdag.py
  > 
9 10 11
  > [rebase]
  > singletransaction=True
  > 
12 13 14 15 16 17 18
  > [phases]
  > publish=False
  > 
  > [alias]
  > tglog = log -G --template "{rev}: {desc}"
  > EOF

19 20 21 22 23 24 25
#if continueflag
  $ cat >> $HGRCPATH <<EOF
  > [alias]
  > continue = rebase --continue
  > EOF
#endif

26
Check that a simple rebase works
27

28
  $ hg init simple && cd simple
29 30 31 32 33 34 35 36 37 38 39
  $ hg debugdrawdag <<'EOF'
  >   Z
  >   |
  >   | D
  >   | |
  >   | C
  >   | |
  >   Y B
  >   |/
  >   A
  > EOF
40
- We should only see one status stored message. It comes from the start.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  $ hg rebase --debug -b D -d Z | grep 'status stored'
  rebase status stored
  $ hg tglog
  o  5: D
  |
  o  4: C
  |
  o  3: B
  |
  o  2: Z
  |
  o  1: Y
  |
  o  0: A
  
  $ cd ..
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

Check that --collapse works

  $ hg init collapse && cd collapse
  $ hg debugdrawdag <<'EOF'
  >   Z
  >   |
  >   | D
  >   | |
  >   | C
  >   | |
  >   Y B
  >   |/
  >   A
  > EOF
- We should only see two status stored messages. One from the start, one from
73
- cmdutil.commitforceeditor() which forces tr.writepending()
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
  $ hg rebase --collapse --debug -b D -d Z | grep 'status stored'
  rebase status stored
  rebase status stored
  $ hg tglog
  o  3: Collapsed revision
  |  * B
  |  * C
  |  * D
  o  2: Z
  |
  o  1: Y
  |
  o  0: A
  
  $ cd ..

With --collapse, check that conflicts can be resolved and rebase can then be
continued

  $ hg init collapse-conflict && cd collapse-conflict
  $ hg debugdrawdag <<'EOF'
  >   Z   # Z/conflict=Z
  >   |
  >   | D
  >   | |
  >   | C # C/conflict=C
  >   | |
  >   Y B
  >   |/
  >   A
  > EOF
  $ hg rebase --collapse -b D -d Z
106 107
  rebasing 1:112478962961 B "B"
  rebasing 3:c26739dbe603 C "C"
108 109
  merging conflict
  warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
110
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
111
  [240]
112 113 114 115 116
  $ hg tglog
  o  5: D
  |
  | @  4: Z
  | |
117
  % |  3: C
118 119 120 121 122 123 124 125 126 127
  | |
  | o  2: Y
  | |
  o |  1: B
  |/
  o  0: A
  
  $ hg st
  M conflict
  A B
128
  A C
129 130 131 132 133
  ? conflict.orig
  $ echo resolved > conflict
  $ hg resolve -m
  (no more unresolved files)
  continue: hg rebase --continue
134
  $ hg continue
135 136 137
  already rebased 1:112478962961 B "B" as 79bc8f4973ce
  rebasing 3:c26739dbe603 C "C"
  rebasing 5:d24bb333861c D tip "D"
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
  saved backup bundle to $TESTTMP/collapse-conflict/.hg/strip-backup/112478962961-b5b34645-rebase.hg
  $ hg tglog
  o  3: Collapsed revision
  |  * B
  |  * C
  |  * D
  o  2: Z
  |
  o  1: Y
  |
  o  0: A
  
  $ cd ..

With --collapse, check that the commit message editing can be canceled and
rebase can then be continued

  $ hg init collapse-cancel-editor && cd collapse-cancel-editor
  $ hg debugdrawdag <<'EOF'
  >   Z
  >   |
  >   | D
  >   | |
  >   | C
  >   | |
  >   Y B
  >   |/
  >   A
  > EOF
  $ HGEDITOR=false hg --config ui.interactive=1 rebase --collapse -b D -d Z
168 169 170
  rebasing 1:112478962961 B "B"
  rebasing 3:26805aba1e60 C "C"
  rebasing 5:f585351a92f8 D tip "D"
171 172
  transaction abort!
  rollback completed
173
  abort: edit failed: false exited with status 1
174
  [250]
175 176 177
  $ hg tglog
  o  5: D
  |
178
  | o  4: Z
179 180 181 182 183 184 185 186 187
  | |
  o |  3: C
  | |
  | o  2: Y
  | |
  o |  1: B
  |/
  o  0: A
  
188
  $ hg continue
189 190 191
  rebasing 1:112478962961 B "B"
  rebasing 3:26805aba1e60 C "C"
  rebasing 5:f585351a92f8 D tip "D"
192 193 194 195 196 197 198 199 200 201 202 203 204
  saved backup bundle to $TESTTMP/collapse-cancel-editor/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
  $ hg tglog
  o  3: Collapsed revision
  |  * B
  |  * C
  |  * D
  o  2: Z
  |
  o  1: Y
  |
  o  0: A
  
  $ cd ..