diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -254,6 +254,14 @@ def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) + # for now we assume that if a server has ellipses enabled, we will be + # exchanging ellipses nodes. In future we should add ellipses as a client + # side requirement (maybe) to distinguish a client is shallow or not and + # then send that information to server whether we want ellipses or not. + # Theoretically a non-ellipses repo should be able to use narrow + # functionality from an ellipses enabled server + ellipsesremote = narrowwirepeer.ELLIPSESCAP in remote.capabilities() + def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -272,15 +280,17 @@ overrides = {('devel', 'all-warnings'): False} with ui.uninterruptable(): - ds = repo.dirstate - p1, p2 = ds.p1(), ds.p2() - with ds.parentchange(): - ds.setparents(node.nullid, node.nullid) + if ellipsesremote: + ds = repo.dirstate + p1, p2 = ds.p1(), ds.p2() + with ds.parentchange(): + ds.setparents(node.nullid, node.nullid) common = commoninc[0] with wrappedextraprepare, repo.ui.configoverride(overrides, 'widen'): exchange.pull(repo, remote, heads=common) - with ds.parentchange(): - ds.setparents(p1, p2) + if ellipsesremote: + with ds.parentchange(): + ds.setparents(p1, p2) repo.setnewnarrowpats() actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -88,6 +88,9 @@ added upstream revisions. $ cd narrow + $ hg id -n + 2 + $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) @@ -127,6 +130,9 @@ $ cat widest/f widest + $ hg id -n + 2 + Pull down the newly added upstream revision. $ hg pull