D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Oct 2 12:55:14 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG693dda764efe: narrow: don't do the dirstate dance if ellipses is not enabled (authored by pulkit, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4788?vs=11517&id=11568
REVISION DETAIL
https://phab.mercurial-scm.org/D4788
AFFECTED FILES
hgext/narrow/narrowcommands.py
tests/test-narrow-widen-no-ellipsis.t
CHANGE DETAILS
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 at 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
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -251,6 +251,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 = wireprotoserver.ELLIPSESCAP in remote.capabilities()
+
def pullbundle2extraprepare_widen(orig, pullop, kwargs):
orig(pullop, kwargs)
# The old{in,ex}cludepats have already been set by orig()
@@ -269,15 +277,21 @@
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)
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:
+ ds = repo.dirstate
+ p1, p2 = ds.p1(), ds.p2()
+ with ds.parentchange():
+ ds.setparents(node.nullid, node.nullid)
+ with wrappedextraprepare,\
+ repo.ui.configoverride(overrides, 'widen'):
+ exchange.pull(repo, remote, heads=common)
+ with ds.parentchange():
+ ds.setparents(p1, p2)
+ else:
+ with wrappedextraprepare,\
+ repo.ui.configoverride(overrides, 'widen'):
+ exchange.pull(repo, remote, heads=common)
repo.setnewnarrowpats()
actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()}
To: pulkit, durin42, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
More information about the Mercurial-devel
mailing list