##// END OF EJS Templates
commit: don't let failed commit with --addremove update dirstate (issue5645)...
Martin von Zweigbergk -
r33619:5ac845ca stable
parent child Browse files
Show More
@@ -26,6 +26,7 b' from . import ('
26 26 changelog,
27 27 copies,
28 28 crecord as crecordmod,
29 dirstateguard,
29 30 encoding,
30 31 error,
31 32 formatter,
@@ -2888,14 +2889,23 b' def commit(ui, repo, commitfunc, pats, o'
2888 2889 message = logmessage(ui, opts)
2889 2890 matcher = scmutil.match(repo[None], pats, opts)
2890 2891
2892 dsguard = None
2891 2893 # extract addremove carefully -- this function can be called from a command
2892 2894 # that doesn't support addremove
2893 if opts.get('addremove'):
2894 if scmutil.addremove(repo, matcher, "", opts) != 0:
2895 raise error.Abort(
2896 _("failed to mark all new/missing files as added/removed"))
2897
2898 return commitfunc(ui, repo, message, matcher, opts)
2895 try:
2896 if opts.get('addremove'):
2897 dsguard = dirstateguard.dirstateguard(repo, 'commit')
2898 if scmutil.addremove(repo, matcher, "", opts) != 0:
2899 raise error.Abort(
2900 _("failed to mark all new/missing files as added/removed"))
2901
2902 r = commitfunc(ui, repo, message, matcher, opts)
2903 if dsguard:
2904 dsguard.close()
2905 return r
2906 finally:
2907 if dsguard:
2908 dsguard.release()
2899 2909
2900 2910 def samefile(f, ctx1, ctx2):
2901 2911 if f in ctx1.manifest():
@@ -157,7 +157,7 b' Failed commit with --addremove should no'
157 157 abort: edit failed: false exited with status 1
158 158 [255]
159 159 $ hg status
160 A newfile
160 ? newfile
161 161
162 162 Make sure we do not obscure unknown requires file entries (issue2649)
163 163
@@ -152,7 +152,6 b''
152 152 $ hg commit -Aqm 'fail+base64+gzip+noop'
153 153 abort: missing processor for flag '0x1'!
154 154 [255]
155 $ hg forget fail-base64-gzip-noop
156 155 $ rm fail-base64-gzip-noop
157 156
158 157 # TEST: ensure we cannot register several flag processors on the same flag
@@ -14,10 +14,12 b''
14 14 $ rm .hg/hgrc
15 15
16 16 $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
17 adding a
17 18 abort: username 'foo\nbar2' contains a newline
18 19
19 20 [255]
20 21 $ hg ci -Am m -u "`(echo foo; echo bar3)`"
22 adding a
21 23 transaction abort!
22 24 rollback completed
23 25 abort: username 'foo\nbar3' contains a newline!
General Comments 0
You need to be logged in to leave comments. Login now