Show More
@@ -614,31 +614,32 b' def import_(ui, repo, patch1, *patches, ' | |||
|
614 | 614 | ui.status("applying %s\n" % patch) |
|
615 | 615 | pf = os.path.join(d, patch) |
|
616 | 616 | |
|
617 |
text = |
|
|
618 | for l in file(pf): | |
|
619 | if l.startswith("--- ") or l.startswith("diff -r"): | |
|
617 | text = [] | |
|
618 | user = None | |
|
619 | hgpatch = False | |
|
620 | for line in file(pf): | |
|
621 | line = line.rstrip() | |
|
622 | if line.startswith("--- ") or line.startswith("diff -r"): | |
|
620 | 623 | break |
|
621 | text += l | |
|
622 | ||
|
623 | # parse values that exist when importing the result of an hg export | |
|
624 | hgpatch = user = snippet = None | |
|
625 |
ui.debug(' |
|
|
626 | for t in text.splitlines(): | |
|
627 | ui.debug(t, '\n') | |
|
628 |
|
|
|
624 | elif hgpatch: | |
|
625 | # parse values when importing the result of an hg export | |
|
626 | if line.startswith("# User "): | |
|
627 | user = line[7:] | |
|
628 | ui.debug('User: %s\n' % user) | |
|
629 | elif not line.startswith("# ") and line: | |
|
630 | text.append(line) | |
|
631 | hgpatch = False | |
|
632 | elif line == '# HG changeset patch': | |
|
629 | 633 | hgpatch = True |
|
630 | if t.startswith("# User "): | |
|
631 | user = t[7:] | |
|
632 | ui.debug('User: %s\n' % user) | |
|
633 | if not t.startswith("# ") and t.strip() and not snippet: | |
|
634 | snippet = t | |
|
635 | if snippet: | |
|
636 | text = snippet + '\n' + text | |
|
637 | ui.debug('text:\n%s\n' % text) | |
|
634 | else: | |
|
635 | text.append(line) | |
|
638 | 636 | |
|
639 | 637 | # make sure text isn't empty |
|
640 | 638 | if not text: |
|
641 | 639 | text = "imported patch %s\n" % patch |
|
640 | else: | |
|
641 | text = "%s\n" % '\n'.join(text) | |
|
642 | ui.debug('text:\n%s\n' % text) | |
|
642 | 643 | |
|
643 | 644 | f = os.popen("patch -p%d < %s" % (strip, pf)) |
|
644 | 645 | files = [] |
General Comments 0
You need to be logged in to leave comments.
Login now