##// END OF EJS Templates
histedit: save manually edited commit message into ".hg/last-message.txt"...
FUJIWARA Katsunori -
r20770:5d22cadd stable
parent child Browse files
Show More
@@ -294,6 +294,7 b' def collapse(repo, first, last, commitop'
294 date=date,
294 date=date,
295 extra=extra)
295 extra=extra)
296 new._text = cmdutil.commitforceeditor(repo, new, [])
296 new._text = cmdutil.commitforceeditor(repo, new, [])
297 repo.savecommitmessage(new.description())
297 return repo.commitctx(new)
298 return repo.commitctx(new)
298
299
299 def pick(ui, repo, ctx, ha, opts):
300 def pick(ui, repo, ctx, ha, opts):
@@ -105,6 +105,69 b' check histedit_source'
105
105
106
106
107
107
108 check saving last-message.txt
109
110 $ cat > $TESTDIR/abortfolding.py <<EOF
111 > from mercurial import util
112 > def abortfolding(ui, repo, hooktype, **kwargs):
113 > ctx = repo[kwargs.get('node')]
114 > if set(ctx.files()) == set(['c', 'd', 'f']):
115 > return True # abort folding commit only
116 > ui.warn('allow non-folding commit\\n')
117 > EOF
118 $ cat > .hg/hgrc <<EOF
119 > [hooks]
120 > pretxncommit.abortfolding = python:$TESTDIR/abortfolding.py:abortfolding
121 > EOF
122
123 $ cat > $TESTDIR/editor.sh << EOF
124 > echo "==== before editing"
125 > cat \$1
126 > echo "===="
127 > echo "check saving last-message.txt" >> \$1
128 > EOF
129
130 $ rm -f .hg/last-message.txt
131 $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
132 > pick 6de59d13424a f
133 > fold 9c277da72c9b d
134 > EOF
135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
136 allow non-folding commit
137 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
138 ==== before editing
139 f
140 ***
141 c
142 ***
143 d
144
145
146
147 HG: Enter commit message. Lines beginning with 'HG:' are removed.
148 HG: Leave message empty to abort commit.
149 HG: --
150 HG: user: test
151 HG: branch 'default'
152 HG: changed c
153 HG: changed d
154 HG: changed f
155 ====
156 transaction abort!
157 rollback completed
158 abort: pretxncommit.abortfolding hook failed
159
160 $ cat .hg/last-message.txt
161 f
162 ***
163 c
164 ***
165 d
166
167
168
169 check saving last-message.txt
170
108 $ cd ..
171 $ cd ..
109
172
110 folding and creating no new change doesn't break:
173 folding and creating no new change doesn't break:
General Comments 0
You need to be logged in to leave comments. Login now