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