comparison mercurial/commands.py @ 21720:db2392a4effc

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 09 Jun 2014 13:53:23 -0500
parents 51035af2c0bf 14560418856d
children 6539c4e9c874
comparison
equal deleted inserted replaced
21719:28ecdf3fa1db 21720:db2392a4effc
4941 raise util.Abort(_("can't specify --all and patterns")) 4941 raise util.Abort(_("can't specify --all and patterns"))
4942 if not (all or pats or show or mark or unmark): 4942 if not (all or pats or show or mark or unmark):
4943 raise util.Abort(_('no files or directories specified; ' 4943 raise util.Abort(_('no files or directories specified; '
4944 'use --all to remerge all files')) 4944 'use --all to remerge all files'))
4945 4945
4946 ms = mergemod.mergestate(repo) 4946 wlock = repo.wlock()
4947 4947 try:
4948 if not ms.active() and not show: 4948 ms = mergemod.mergestate(repo)
4949 raise util.Abort(_('resolve command not applicable when not merging')) 4949
4950 4950 if not ms.active() and not show:
4951 m = scmutil.match(repo[None], pats, opts) 4951 raise util.Abort(
4952 ret = 0 4952 _('resolve command not applicable when not merging'))
4953 4953
4954 didwork = False 4954 m = scmutil.match(repo[None], pats, opts)
4955 for f in ms: 4955 ret = 0
4956 if not m(f): 4956 didwork = False
4957 continue 4957
4958 4958 for f in ms:
4959 didwork = True 4959 if not m(f):
4960 4960 continue
4961 if show: 4961
4962 if nostatus: 4962 didwork = True
4963 ui.write("%s\n" % f) 4963
4964 if show:
4965 if nostatus:
4966 ui.write("%s\n" % f)
4967 else:
4968 ui.write("%s %s\n" % (ms[f].upper(), f),
4969 label='resolve.' +
4970 {'u': 'unresolved', 'r': 'resolved'}[ms[f]])
4971 elif mark:
4972 ms.mark(f, "r")
4973 elif unmark:
4974 ms.mark(f, "u")
4964 else: 4975 else:
4965 ui.write("%s %s\n" % (ms[f].upper(), f), 4976 wctx = repo[None]
4966 label='resolve.' + 4977
4967 {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) 4978 # backup pre-resolve (merge uses .orig for its own purposes)
4968 elif mark: 4979 a = repo.wjoin(f)
4969 ms.mark(f, "r") 4980 util.copyfile(a, a + ".resolve")
4970 elif unmark: 4981
4971 ms.mark(f, "u") 4982 try:
4972 else: 4983 # resolve file
4973 wctx = repo[None] 4984 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4974 4985 'resolve')
4975 # backup pre-resolve (merge uses .orig for its own purposes) 4986 if ms.resolve(f, wctx):
4976 a = repo.wjoin(f) 4987 ret = 1
4977 util.copyfile(a, a + ".resolve") 4988 finally:
4978 4989 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4979 try: 4990 ms.commit()
4980 # resolve file 4991
4981 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 4992 # replace filemerge's .orig file with our resolve file
4982 'resolve') 4993 util.rename(a + ".resolve", a + ".orig")
4983 if ms.resolve(f, wctx): 4994
4984 ret = 1 4995 ms.commit()
4985 finally: 4996
4986 ui.setconfig('ui', 'forcemerge', '', 'resolve') 4997 if not didwork and pats:
4987 ms.commit() 4998 ui.warn(_("arguments do not match paths that need resolved\n"))
4988 4999
4989 # replace filemerge's .orig file with our resolve file 5000 finally:
4990 util.rename(a + ".resolve", a + ".orig") 5001 wlock.release()
4991
4992 ms.commit()
4993
4994 if not didwork and pats:
4995 ui.warn(_("arguments do not match paths that need resolved\n"))
4996 5002
4997 # Nudge users into finishing an unfinished operation. We don't print 5003 # Nudge users into finishing an unfinished operation. We don't print
4998 # this with the list/show operation because we want list/show to remain 5004 # this with the list/show operation because we want list/show to remain
4999 # machine readable. 5005 # machine readable.
5000 if not list(ms.unresolved()) and not show: 5006 if not list(ms.unresolved()) and not show: