Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGe7eea8582afa: py3: use pycompat.{strkwargs|byteskwargs} in infinitepush
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| indygreg |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| error, | error, | ||||
| exchange, | exchange, | ||||
| extensions, | extensions, | ||||
| hg, | hg, | ||||
| localrepo, | localrepo, | ||||
| peer, | peer, | ||||
| phases, | phases, | ||||
| pushkey, | pushkey, | ||||
| pycompat, | |||||
| registrar, | registrar, | ||||
| util, | util, | ||||
| wireproto, | wireproto, | ||||
| ) | ) | ||||
| from . import ( | from . import ( | ||||
| bundleparts, | bundleparts, | ||||
| common, | common, | ||||
| if repo.bundlestore.index.getbundle(localkey): | if repo.bundlestore.index.getbundle(localkey): | ||||
| return "%s %s\n" % (1, localkey) | return "%s %s\n" % (1, localkey) | ||||
| else: | else: | ||||
| r = str(inst) | r = str(inst) | ||||
| return "%s %s\n" % (0, r) | return "%s %s\n" % (0, r) | ||||
| return _lookup | return _lookup | ||||
| def _pull(orig, ui, repo, source="default", **opts): | def _pull(orig, ui, repo, source="default", **opts): | ||||
| opts = pycompat.byteskwargs(opts) | |||||
| # Copy paste from `pull` command | # Copy paste from `pull` command | ||||
| source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | ||||
| scratchbookmarks = {} | scratchbookmarks = {} | ||||
| unfi = repo.unfiltered() | unfi = repo.unfiltered() | ||||
| unknownnodes = [] | unknownnodes = [] | ||||
| for rev in opts.get('rev', []): | for rev in opts.get('rev', []): | ||||
| if rev not in unfi: | if rev not in unfi: | ||||
| if scratchbookmarks or unknownnodes: | if scratchbookmarks or unknownnodes: | ||||
| # Set anyincoming to True | # Set anyincoming to True | ||||
| extensions.wrapfunction(discovery, 'findcommonincoming', | extensions.wrapfunction(discovery, 'findcommonincoming', | ||||
| _findcommonincoming) | _findcommonincoming) | ||||
| try: | try: | ||||
| # Remote scratch bookmarks will be deleted because remotenames doesn't | # Remote scratch bookmarks will be deleted because remotenames doesn't | ||||
| # know about them. Let's save it before pull and restore after | # know about them. Let's save it before pull and restore after | ||||
| remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, source) | remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, source) | ||||
| result = orig(ui, repo, source, **opts) | result = orig(ui, repo, source, **pycompat.strkwargs(opts)) | ||||
| # TODO(stash): race condition is possible | # TODO(stash): race condition is possible | ||||
| # if scratch bookmarks was updated right after orig. | # if scratch bookmarks was updated right after orig. | ||||
| # But that's unlikely and shouldn't be harmful. | # But that's unlikely and shouldn't be harmful. | ||||
| if common.isremotebooksenabled(ui): | if common.isremotebooksenabled(ui): | ||||
| remotescratchbookmarks.update(scratchbookmarks) | remotescratchbookmarks.update(scratchbookmarks) | ||||
| _saveremotebookmarks(repo, remotescratchbookmarks, source) | _saveremotebookmarks(repo, remotescratchbookmarks, source) | ||||
| else: | else: | ||||
| _savelocalbookmarks(repo, scratchbookmarks) | _savelocalbookmarks(repo, scratchbookmarks) | ||||