Mercurial > hg
comparison mercurial/cmdutil.py @ 22278:ffaaa80fa724
import: avoid editor invocation when importing with "--exact" for exact-ness
Before this patch, external editor is invoked when imported patch has
no commit message, even if "--exact" is specified. Then, exact-ness is
broken, because empty commit message causes failure of committing.
This patch avoids editor invocation at importing with "--exact" for
exact-ness, because commit message in the patch should be kept as it
is in such case, even if it is empty.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 23 Aug 2014 23:03:50 +0900 |
parents | 2229d757802d |
children | 650b5b6e75ed |
comparison
equal
deleted
inserted
replaced
22277:e116abad3afa | 22278:ffaaa80fa724 |
---|---|
686 # being updated to its first parent. | 686 # being updated to its first parent. |
687 m = None | 687 m = None |
688 else: | 688 else: |
689 m = scmutil.matchfiles(repo, files or []) | 689 m = scmutil.matchfiles(repo, files or []) |
690 editform = mergeeditform(repo[None], 'import.normal') | 690 editform = mergeeditform(repo[None], 'import.normal') |
691 editor = getcommiteditor(editform=editform, **opts) | 691 if opts.get('exact'): |
692 editor = None | |
693 else: | |
694 editor = getcommiteditor(editform=editform, **opts) | |
692 n = repo.commit(message, opts.get('user') or user, | 695 n = repo.commit(message, opts.get('user') or user, |
693 opts.get('date') or date, match=m, | 696 opts.get('date') or date, match=m, |
694 editor=editor, force=partial) | 697 editor=editor, force=partial) |
695 else: | 698 else: |
696 if opts.get('exact') or opts.get('import_branch'): | 699 if opts.get('exact') or opts.get('import_branch'): |
703 try: | 706 try: |
704 patch.patchrepo(ui, repo, p1, store, tmpname, strip, | 707 patch.patchrepo(ui, repo, p1, store, tmpname, strip, |
705 files, eolmode=None) | 708 files, eolmode=None) |
706 except patch.PatchError, e: | 709 except patch.PatchError, e: |
707 raise util.Abort(str(e)) | 710 raise util.Abort(str(e)) |
708 editor = getcommiteditor(editform='import.bypass') | 711 if opts.get('exact'): |
712 editor = None | |
713 else: | |
714 editor = getcommiteditor(editform='import.bypass') | |
709 memctx = context.makememctx(repo, (p1.node(), p2.node()), | 715 memctx = context.makememctx(repo, (p1.node(), p2.node()), |
710 message, | 716 message, |
711 opts.get('user') or user, | 717 opts.get('user') or user, |
712 opts.get('date') or date, | 718 opts.get('date') or date, |
713 branch, files, store, | 719 branch, files, store, |