comparison tests/test-amend-patch.t @ 3661:61fdd25542a6

patch: offer the user a chance to fix the patch if it fails to apply The experience is still not great, but better than purely dropping the changes.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 11 Apr 2018 07:23:34 +0200
parents f018656ca3bf
children e5ba6531503e c464abfd7f9d
comparison
equal deleted inserted replaced
3660:f018656ca3bf 3661:61fdd25542a6
137 > +Gello 137 > +Gello
138 > ENDOF 138 > ENDOF
139 > EOF 139 > EOF
140 140
141 $ HGEDITOR="sh ./editor.sh" hg amend --patch 141 $ HGEDITOR="sh ./editor.sh" hg amend --patch
142 abort: bad hunk #1 @@ -0,0 +1,1 @@ 142 failed to apply edited patch: bad hunk #1 @@ -0,0 +1,1 @@
143 (1 0 1 1) 143 (1 0 1 1)
144 try to fix the patch (yn)? y
145 abort: patch unchanged
144 [255] 146 [255]
145 147
146 Having deletions which dont exists 148 Having deletions which dont exists
147 149
148 $ cat > editor.sh <<EOF 150 $ cat > editor.sh <<EOF
164 > +Gello 166 > +Gello
165 > ENDOF 167 > ENDOF
166 > EOF 168 > EOF
167 169
168 $ HGEDITOR="sh ./editor.sh" hg amend --patch 170 $ HGEDITOR="sh ./editor.sh" hg amend --patch
169 abort: bad hunk #1 @@ -0,0 +1,1 @@ 171 failed to apply edited patch: bad hunk #1 @@ -0,0 +1,1 @@
170 (1 0 1 1) 172 (1 0 1 1)
173 try to fix the patch (yn)? y
174 abort: patch unchanged
171 [255] 175 [255]
172 176
173 Changing the file mode using amend --patch 177 Changing the file mode using amend --patch
174 ------------------------------------------ 178 ------------------------------------------
175 179
323 > EOF 327 > EOF
324 328
325 $ HGEDITOR="sh ./editor.sh" hg amend --patch 329 $ HGEDITOR="sh ./editor.sh" hg amend --patch
326 patching file changedfile 330 patching file changedfile
327 Hunk #1 FAILED at 0 331 Hunk #1 FAILED at 0
328 abort: patch failed to apply 332 failed to apply edited patch: patch failed to apply
333 try to fix the patch (yn)? y
334 abort: patch unchanged
329 [255] 335 [255]
330 336
331 Add more addition to the patch 337 Add more addition to the patch
332 338
333 $ cat > editor.sh <<EOF 339 $ cat > editor.sh <<EOF
731 --- a/changedfile 737 --- a/changedfile
732 +++ /dev/null 738 +++ /dev/null
733 @@ -1,2 +0,0 @@ 739 @@ -1,2 +0,0 @@
734 -foobar 740 -foobar
735 -babar 741 -babar
736 abort: nothing changed 742 abort: patch unchanged
737 [255] 743 [255]
738 744
739 $ HGEDITOR=cat hg amend --patch doesnotexists 745 $ HGEDITOR=cat hg amend --patch doesnotexists
740 # HG changeset patch 746 # HG changeset patch
741 # User test 747 # User test