Show More
@@ -8,6 +8,7 b'' | |||||
8 |
|
8 | |||
9 | import copy as copymod |
|
9 | import copy as copymod | |
10 | import errno |
|
10 | import errno | |
|
11 | import functools | |||
11 | import os |
|
12 | import os | |
12 | import re |
|
13 | import re | |
13 |
|
14 | |||
@@ -440,22 +441,17 b' def recordfilter(ui, originalhunks, matc' | |||||
440 | return newchunks, newopts |
|
441 | return newchunks, newopts | |
441 |
|
442 | |||
442 |
|
443 | |||
443 |
def |
|
444 | def _record( | |
444 | ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts |
|
445 | ui, | |
|
446 | repo, | |||
|
447 | message, | |||
|
448 | match, | |||
|
449 | opts, | |||
|
450 | commitfunc, | |||
|
451 | backupall, | |||
|
452 | filterfn, | |||
|
453 | pats, | |||
445 | ): |
|
454 | ): | |
446 | opts = pycompat.byteskwargs(opts) |
|
|||
447 | if not ui.interactive(): |
|
|||
448 | if cmdsuggest: |
|
|||
449 | msg = _(b'running non-interactively, use %s instead') % cmdsuggest |
|
|||
450 | else: |
|
|||
451 | msg = _(b'running non-interactively') |
|
|||
452 | raise error.InputError(msg) |
|
|||
453 |
|
||||
454 | # make sure username is set before going interactive |
|
|||
455 | if not opts.get(b'user'): |
|
|||
456 | ui.username() # raise exception, username not provided |
|
|||
457 |
|
||||
458 | def recordfunc(ui, repo, message, match, opts): |
|
|||
459 |
|
|
455 | """This is generic record driver. | |
460 |
|
456 | |||
461 |
|
|
457 | Its job is to interactively filter local changes, and | |
@@ -476,10 +472,7 b' def dorecord(' | |||||
476 |
|
|
472 | merge = len(wctx.parents()) > 1 | |
477 |
|
|
473 | if merge: | |
478 |
|
|
474 | raise error.InputError( | |
479 | _( |
|
475 | _(b'cannot partially commit a merge ' b'(use "hg commit" instead)') | |
480 | b'cannot partially commit a merge ' |
|
|||
481 | b'(use "hg commit" instead)' |
|
|||
482 | ) |
|
|||
483 |
|
|
476 | ) | |
484 |
|
477 | |||
485 |
|
|
478 | def fail(f, msg): | |
@@ -597,9 +590,7 b' def dorecord(' | |||||
597 |
|
|
590 | # 2.5 optionally review / modify patch in text editor | |
598 |
|
|
591 | if opts.get(b'review', False): | |
599 |
|
|
592 | patchtext = ( | |
600 |
|
|
593 | crecordmod.diffhelptext + crecordmod.patchhelptext + fp.read() | |
601 | + crecordmod.patchhelptext |
|
|||
602 | + fp.read() |
|
|||
603 |
|
|
594 | ) | |
604 |
|
|
595 | reviewedpatch = ui.edit( | |
605 |
|
|
596 | patchtext, b"", action=b"diff", repopath=repo.path | |
@@ -670,7 +661,31 b' def dorecord(' | |||||
670 |
|
|
661 | except OSError: | |
671 |
|
|
662 | pass | |
672 |
|
663 | |||
673 | return commit(ui, repo, recordfunc, pats, opts) |
|
664 | ||
|
665 | def dorecord( | |||
|
666 | ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts | |||
|
667 | ): | |||
|
668 | opts = pycompat.byteskwargs(opts) | |||
|
669 | if not ui.interactive(): | |||
|
670 | if cmdsuggest: | |||
|
671 | msg = _(b'running non-interactively, use %s instead') % cmdsuggest | |||
|
672 | else: | |||
|
673 | msg = _(b'running non-interactively') | |||
|
674 | raise error.InputError(msg) | |||
|
675 | ||||
|
676 | # make sure username is set before going interactive | |||
|
677 | if not opts.get(b'user'): | |||
|
678 | ui.username() # raise exception, username not provided | |||
|
679 | ||||
|
680 | func = functools.partial( | |||
|
681 | _record, | |||
|
682 | commitfunc=commitfunc, | |||
|
683 | backupall=backupall, | |||
|
684 | filterfn=filterfn, | |||
|
685 | pats=pats, | |||
|
686 | ) | |||
|
687 | ||||
|
688 | return commit(ui, repo, func, pats, opts) | |||
674 |
|
689 | |||
675 |
|
690 | |||
676 | class dirnode: |
|
691 | class dirnode: |
General Comments 0
You need to be logged in to leave comments.
Login now