equal
deleted
inserted
replaced
584 text = "" |
584 text = "" |
585 for l in file(pf): |
585 for l in file(pf): |
586 if l[:4] == "--- ": break |
586 if l[:4] == "--- ": break |
587 text += l |
587 text += l |
588 |
588 |
|
589 # parse values that exist when importing the result of an hg export |
|
590 hgpatch = user = snippet = None |
|
591 ui.debug('text:\n') |
|
592 for t in text.splitlines(): |
|
593 ui.debug(t,'\n') |
|
594 if t == '# HG changeset patch' or hgpatch == True: |
|
595 hgpatch = True |
|
596 if t[:7] == "# User ": |
|
597 user = t[7:] |
|
598 ui.debug('User: %s\n' % user) |
|
599 if t[:2] <> "# " and t.strip() and not snippet: snippet = t |
|
600 if snippet: text = snippet + '\n' + text |
|
601 ui.debug('text:\n%s\n' % text) |
|
602 |
589 # make sure text isn't empty |
603 # make sure text isn't empty |
590 if not text: text = "imported patch %s\n" % patch |
604 if not text: text = "imported patch %s\n" % patch |
591 |
605 |
592 f = os.popen("patch -p%d < %s" % (strip, pf)) |
606 f = os.popen("patch -p%d < %s" % (strip, pf)) |
593 files = [] |
607 files = [] |
603 sys.stderr.write("patch failed") |
617 sys.stderr.write("patch failed") |
604 sys.exit(1) |
618 sys.exit(1) |
605 |
619 |
606 if len(files) > 0: |
620 if len(files) > 0: |
607 addremove(ui, repo, *files) |
621 addremove(ui, repo, *files) |
608 repo.commit(files, text) |
622 repo.commit(files, text, user) |
609 |
623 |
610 def init(ui, source=None): |
624 def init(ui, source=None): |
611 """create a new repository in the current directory""" |
625 """create a new repository in the current directory""" |
612 |
626 |
613 if source: |
627 if source: |