# HG changeset patch # User Gregory Szorc # Date 1397872586 25200 # Node ID 232de244ab6f8d80368f2f9d0a6277e60fc497bc # Parent 4e932dc5c113f003eefda05a2dae8cf7da9f2c2b resolve: print warning when no work performed (issue4208) Previously, if the paths specified as arguments to |hg resolve| were invalid, they were silently ignored and a no-op would ensue. This patch fixes that in some scenarios. If none of the paths specified to |hg resolve| match a path that is in mergestate, a warning will be emitted. Ideally, a warning would be emitted for every path/pattern specified that doesn't match anything. To achieve this would require significant refactoring of the matching subsystem. That work is beyond the scope of this patch series. Something is better than nothing and this patch gets us something. diff -r 4e932dc5c113 -r 232de244ab6f mercurial/commands.py --- a/mercurial/commands.py Fri Apr 18 19:08:32 2014 -0700 +++ b/mercurial/commands.py Fri Apr 18 18:56:26 2014 -0700 @@ -4934,10 +4934,13 @@ m = scmutil.match(repo[None], pats, opts) ret = 0 + didwork = False for f in ms: if not m(f): continue + didwork = True + if show: if nostatus: ui.write("%s\n" % f) @@ -4970,6 +4973,10 @@ util.rename(a + ".resolve", a + ".orig") ms.commit() + + if not didwork and pats: + ui.warn(_("arguments do not match paths that need resolved\n")) + return ret @command('revert', diff -r 4e932dc5c113 -r 232de244ab6f tests/test-resolve.t --- a/tests/test-resolve.t Fri Apr 18 19:08:32 2014 -0700 +++ b/tests/test-resolve.t Fri Apr 18 18:56:26 2014 -0700 @@ -31,6 +31,10 @@ $ hg resolve -l U file +resolving an unknown path emits a warning + $ hg resolve -m does-not-exist + arguments do not match paths that need resolved + resolve the failure $ echo resolved > file