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