1512 p2 = repo.lookup(p2 or hex(nullid)) |
1512 p2 = repo.lookup(p2 or hex(nullid)) |
1513 |
1513 |
1514 if p1 != wp[0].node(): |
1514 if p1 != wp[0].node(): |
1515 hg.clean(repo, p1, wlock=wlock) |
1515 hg.clean(repo, p1, wlock=wlock) |
1516 repo.dirstate.setparents(p1, p2) |
1516 repo.dirstate.setparents(p1, p2) |
1517 repo.dirstate.setbranch(branch or 'default') |
|
1518 elif p2: |
1517 elif p2: |
1519 try: |
1518 try: |
1520 p1 = repo.lookup(p1) |
1519 p1 = repo.lookup(p1) |
1521 p2 = repo.lookup(p2) |
1520 p2 = repo.lookup(p2) |
1522 if p1 == wp[0].node(): |
1521 if p1 == wp[0].node(): |
1523 repo.dirstate.setparents(p1, p2) |
1522 repo.dirstate.setparents(p1, p2) |
1524 except hg.RepoError: |
1523 except hg.RepoError: |
1525 pass |
1524 pass |
|
1525 if opts.get('exact') or opts.get('import-branch'): |
|
1526 repo.dirstate.setbranch(branch or 'default') |
1526 |
1527 |
1527 files = {} |
1528 files = {} |
1528 try: |
1529 try: |
1529 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
1530 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
1530 files=files) |
1531 files=files) |
2801 'meaning as the corresponding patch option')), |
2802 'meaning as the corresponding patch option')), |
2802 ('b', 'base', '', _('base path')), |
2803 ('b', 'base', '', _('base path')), |
2803 ('f', 'force', None, |
2804 ('f', 'force', None, |
2804 _('skip check for outstanding uncommitted changes')), |
2805 _('skip check for outstanding uncommitted changes')), |
2805 ('', 'exact', None, |
2806 ('', 'exact', None, |
2806 _('apply patch to the nodes from which it was generated'))] + commitopts, |
2807 _('apply patch to the nodes from which it was generated')), |
|
2808 ('', 'import-branch', None, |
|
2809 _('Use any branch information in patch (implied by --exact)'))] + commitopts, |
2807 _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')), |
2810 _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')), |
2808 "incoming|in": (incoming, |
2811 "incoming|in": (incoming, |
2809 [('M', 'no-merges', None, _('do not show merges')), |
2812 [('M', 'no-merges', None, _('do not show merges')), |
2810 ('f', 'force', None, |
2813 ('f', 'force', None, |
2811 _('run even when remote repository is unrelated')), |
2814 _('run even when remote repository is unrelated')), |