##// END OF EJS Templates
crecord: exit edition of hunk with non-zero status does not interrupt session...
Laurent Charignon -
r25557:52c552a0 default
parent child Browse files
Show More
@@ -1468,9 +1468,11 b' are you sure you want to review/edit and'
1468 1468 f.close()
1469 1469 # start the editor and wait for it to complete
1470 1470 editor = self.ui.geteditor()
1471 self.ui.system("%s \"%s\"" % (editor, patchfn),
1472 environ={'hguser': self.ui.username()},
1473 onerr=util.Abort, errprefix=_("edit failed"))
1471 ret = self.ui.system("%s \"%s\"" % (editor, patchfn),
1472 environ={'hguser': self.ui.username()})
1473 if ret != 0:
1474 self.errorstr = "Editor exited with status %d" % ret
1475 return None
1474 1476 # remove comment lines
1475 1477 patchfp = open(patchfn)
1476 1478 ncpatchfp = cStringIO.StringIO()
@@ -1495,6 +1497,10 b' are you sure you want to review/edit and'
1495 1497
1496 1498 beforeadded, beforeremoved = item.added, item.removed
1497 1499 newpatches = editpatchwitheditor(self, item)
1500 if newpatches is None:
1501 if not test:
1502 updateui(self)
1503 return
1498 1504 header = item.header
1499 1505 editedhunkindex = header.hunks.index(item)
1500 1506 hunksbefore = header.hunks[:editedhunkindex]
@@ -65,14 +65,16 b' Committing only one file'
65 65 a
66 66 a
67 67
68 Committing only one hunk
68 Committing only one hunk while aborting edition of hunk
69 69
70 70 - Untoggle all the hunks, go down to the second file
71 71 - unfold it
72 72 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
73 73 - toggle the second hunk
74 - edit the hunk and quit the editor imediately with non-zero status
74 75 - commit
75 76
77 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
76 78 $ echo "x" > c
77 79 $ cat b >> c
78 80 $ echo "y" >> c
@@ -86,9 +88,12 b' Committing only one hunk'
86 88 > KEY_DOWN
87 89 > KEY_DOWN
88 90 > TOGGLE
91 > e
89 92 > X
90 93 > EOF
91 $ hg commit -i -m "one hunk" -d "0 0"
94 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
95 editor ran
96 $ rm editor.sh
92 97 $ hg tip
93 98 changeset: 2:7d10dfe755a8
94 99 tag: tip
General Comments 0
You need to be logged in to leave comments. Login now