Show More
@@ -4605,47 +4605,50 b' def pull(ui, repo, source="default", **o' | |||||
4605 | """ |
|
4605 | """ | |
4606 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) |
|
4606 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | |
4607 | other = hg.peer(repo, opts, source) |
|
4607 | other = hg.peer(repo, opts, source) | |
4608 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) |
|
4608 | try: | |
4609 | revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) |
|
4609 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) | |
4610 |
|
4610 | revs, checkout = hg.addbranchrevs(repo, other, branches, | ||
4611 | remotebookmarks = other.listkeys('bookmarks') |
|
4611 | opts.get('rev')) | |
4612 |
|
4612 | |||
4613 | if opts.get('bookmark'): |
|
4613 | remotebookmarks = other.listkeys('bookmarks') | |
4614 | if not revs: |
|
4614 | ||
4615 | revs = [] |
|
4615 | if opts.get('bookmark'): | |
4616 | for b in opts['bookmark']: |
|
4616 | if not revs: | |
4617 | if b not in remotebookmarks: |
|
4617 | revs = [] | |
4618 | raise util.Abort(_('remote bookmark %s not found!') % b) |
|
4618 | for b in opts['bookmark']: | |
4619 |
|
|
4619 | if b not in remotebookmarks: | |
4620 |
|
4620 | raise util.Abort(_('remote bookmark %s not found!') % b) | ||
4621 | if revs: |
|
4621 | revs.append(remotebookmarks[b]) | |
|
4622 | ||||
|
4623 | if revs: | |||
|
4624 | try: | |||
|
4625 | revs = [other.lookup(rev) for rev in revs] | |||
|
4626 | except error.CapabilityError: | |||
|
4627 | err = _("other repository doesn't support revision lookup, " | |||
|
4628 | "so a rev cannot be specified.") | |||
|
4629 | raise util.Abort(err) | |||
|
4630 | ||||
|
4631 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) | |||
|
4632 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) | |||
|
4633 | if checkout: | |||
|
4634 | checkout = str(repo.changelog.rev(other.lookup(checkout))) | |||
|
4635 | repo._subtoppath = source | |||
4622 | try: |
|
4636 | try: | |
4623 | revs = [other.lookup(rev) for rev in revs] |
|
4637 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) | |
4624 | except error.CapabilityError: |
|
4638 | ||
4625 | err = _("other repository doesn't support revision lookup, " |
|
4639 | finally: | |
4626 | "so a rev cannot be specified.") |
|
4640 | del repo._subtoppath | |
4627 | raise util.Abort(err) |
|
4641 | ||
4628 |
|
4642 | # update specified bookmarks | ||
4629 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) |
|
4643 | if opts.get('bookmark'): | |
4630 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) |
|
4644 | marks = repo._bookmarks | |
4631 | if checkout: |
|
4645 | for b in opts['bookmark']: | |
4632 | checkout = str(repo.changelog.rev(other.lookup(checkout))) |
|
4646 | # explicit pull overrides local bookmark if any | |
4633 | repo._subtoppath = source |
|
4647 | ui.status(_("importing bookmark %s\n") % b) | |
4634 | try: |
|
4648 | marks[b] = repo[remotebookmarks[b]].node() | |
4635 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) |
|
4649 | marks.write() | |
4636 |
|
||||
4637 | finally: |
|
4650 | finally: | |
4638 | del repo._subtoppath |
|
4651 | other.close() | |
4639 |
|
||||
4640 | # update specified bookmarks |
|
|||
4641 | if opts.get('bookmark'): |
|
|||
4642 | marks = repo._bookmarks |
|
|||
4643 | for b in opts['bookmark']: |
|
|||
4644 | # explicit pull overrides local bookmark if any |
|
|||
4645 | ui.status(_("importing bookmark %s\n") % b) |
|
|||
4646 | marks[b] = repo[remotebookmarks[b]].node() |
|
|||
4647 | marks.write() |
|
|||
4648 |
|
||||
4649 | return ret |
|
4652 | return ret | |
4650 |
|
4653 | |||
4651 | @command('^push', |
|
4654 | @command('^push', |
@@ -84,6 +84,11 b' Pull full.hg into test (using --cwd)' | |||||
84 | searching for changes |
|
84 | searching for changes | |
85 | no changes found |
|
85 | no changes found | |
86 |
|
86 | |||
|
87 | Verify that there are no leaked temporary files after pull (issue2797) | |||
|
88 | ||||
|
89 | $ ls test/.hg | grep .hg10un | |||
|
90 | [1] | |||
|
91 | ||||
87 | Pull full.hg into empty (using --cwd) |
|
92 | Pull full.hg into empty (using --cwd) | |
88 |
|
93 | |||
89 | $ hg --cwd empty pull ../full.hg |
|
94 | $ hg --cwd empty pull ../full.hg |
General Comments 0
You need to be logged in to leave comments.
Login now