Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 4473:671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Uses the remote repository's lookup method as pull does and only transfers
what is needed to calculate incoming changesets.
One minor problem:
As only the needed changesets are transfered and stored in a local bundle
repository, the tip tag of this bundle is shows despite not being the tip
changeset of the remote repository.
(see "+tag: tip" in tests/test-incoming-outgoing.out in this patch)
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 01 Jun 2007 19:45:05 +0200 |
parents | cd650cd61b06 |
children | 08ae451148b2 1fcc076fcb17 |
comparison
equal
deleted
inserted
replaced
4448:2d3379c598c1 | 4473:671158f060cc |
---|---|
1552 """ | 1552 """ |
1553 source = ui.expandpath(source) | 1553 source = ui.expandpath(source) |
1554 setremoteconfig(ui, opts) | 1554 setremoteconfig(ui, opts) |
1555 | 1555 |
1556 other = hg.repository(ui, source) | 1556 other = hg.repository(ui, source) |
1557 incoming = repo.findincoming(other, force=opts["force"]) | 1557 revs = None |
1558 if opts['rev']: | |
1559 if 'lookup' in other.capabilities: | |
1560 revs = [other.lookup(rev) for rev in opts['rev']] | |
1561 else: | |
1562 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.") | |
1563 raise util.Abort(error) | |
1564 incoming = repo.findincoming(other, heads=revs, force=opts["force"]) | |
1558 if not incoming: | 1565 if not incoming: |
1559 ui.status(_("no changes found\n")) | 1566 ui.status(_("no changes found\n")) |
1560 return | 1567 return |
1561 | 1568 |
1562 cleanup = None | 1569 cleanup = None |
1563 try: | 1570 try: |
1564 fname = opts["bundle"] | 1571 fname = opts["bundle"] |
1565 if fname or not other.local(): | 1572 if fname or not other.local(): |
1566 # create a bundle (uncompressed if other repo is not local) | 1573 # create a bundle (uncompressed if other repo is not local) |
1567 cg = other.changegroup(incoming, "incoming") | 1574 if revs is None: |
1575 cg = other.changegroup(incoming, "incoming") | |
1576 else: | |
1577 if 'changegroupsubset' not in other.capabilities: | |
1578 raise util.Abort(_("Partial incoming cannot be done because other repository doesn't support changegroupsubset.")) | |
1579 cg = other.changegroupsubset(incoming, revs, 'incoming') | |
1568 bundletype = other.local() and "HG10BZ" or "HG10UN" | 1580 bundletype = other.local() and "HG10BZ" or "HG10UN" |
1569 fname = cleanup = changegroup.writebundle(cg, fname, bundletype) | 1581 fname = cleanup = changegroup.writebundle(cg, fname, bundletype) |
1570 # keep written bundle? | 1582 # keep written bundle? |
1571 if opts["bundle"]: | 1583 if opts["bundle"]: |
1572 cleanup = None | 1584 cleanup = None |
1573 if not other.local(): | 1585 if not other.local(): |
1574 # use the created uncompressed bundlerepo | 1586 # use the created uncompressed bundlerepo |
1575 other = bundlerepo.bundlerepository(ui, repo.root, fname) | 1587 other = bundlerepo.bundlerepository(ui, repo.root, fname) |
1576 | 1588 |
1577 revs = None | |
1578 if opts['rev']: | |
1579 revs = [other.lookup(rev) for rev in opts['rev']] | |
1580 o = other.changelog.nodesbetween(incoming, revs)[0] | 1589 o = other.changelog.nodesbetween(incoming, revs)[0] |
1581 if opts['newest_first']: | 1590 if opts['newest_first']: |
1582 o.reverse() | 1591 o.reverse() |
1583 displayer = cmdutil.show_changeset(ui, other, opts) | 1592 displayer = cmdutil.show_changeset(ui, other, opts) |
1584 for n in o: | 1593 for n in o: |