1524 else: |
1524 else: |
1525 # launch the editor |
1525 # launch the editor |
1526 message = None |
1526 message = None |
1527 ui.debug(_('message:\n%s\n') % message) |
1527 ui.debug(_('message:\n%s\n') % message) |
1528 |
1528 |
1529 files = {} |
1529 wp = repo.workingctx().parents() |
1530 if opts.get('exact'): |
1530 if opts.get('exact'): |
1531 if not nodeid or not p1: |
1531 if not nodeid or not p1: |
1532 raise util.Abort(_('not a mercurial patch')) |
1532 raise util.Abort(_('not a mercurial patch')) |
1533 p1 = repo.lookup(p1) |
1533 p1 = repo.lookup(p1) |
1534 p2 = repo.lookup(p2 or hex(nullid)) |
1534 p2 = repo.lookup(p2 or hex(nullid)) |
1535 |
1535 |
1536 wctx = repo.workingctx() |
|
1537 wp = repo.workingctx().parents() |
|
1538 if p1 != wp[0].node(): |
1536 if p1 != wp[0].node(): |
1539 hg.clean(repo, p1, wlock=wlock) |
1537 hg.clean(repo, p1, wlock=wlock) |
1540 repo.dirstate.setparents(p1, p2) |
1538 repo.dirstate.setparents(p1, p2) |
|
1539 elif p2: |
|
1540 try: |
|
1541 p1 = repo.lookup(p1) |
|
1542 p2 = repo.lookup(p2) |
|
1543 if p1 == wp[0].node(): |
|
1544 repo.dirstate.setparents(p1, p2) |
|
1545 except RepoError: |
|
1546 pass |
|
1547 |
|
1548 files = {} |
1541 try: |
1549 try: |
1542 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
1550 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
1543 files=files) |
1551 files=files) |
1544 finally: |
1552 finally: |
1545 files = patch.updatedir(ui, repo, files, wlock=wlock) |
1553 files = patch.updatedir(ui, repo, files, wlock=wlock) |