##// END OF EJS Templates
narrow: consider both local and remote matchers in narrowchangegroup...
Martin von Zweigbergk -
r36485:2d82a24d default
parent child Browse files
Show More
@@ -13,6 +13,7 b' from mercurial import ('
13 error,
13 error,
14 extensions,
14 extensions,
15 manifest,
15 manifest,
16 match as matchmod,
16 mdiff,
17 mdiff,
17 node,
18 node,
18 revlog,
19 revlog,
@@ -21,12 +22,19 b' from mercurial import ('
21
22
22 def setup():
23 def setup():
23
24
25 def _cgmatcher(cgpacker):
26 localmatcher = getattr(cgpacker._repo, 'narrowmatch', lambda: None)()
27 remotematcher = getattr(cgpacker, '_narrow_matcher', lambda: None)()
28 if localmatcher and remotematcher:
29 return matchmod.intersectmatchers(localmatcher, remotematcher)
30 else:
31 return localmatcher or remotematcher
32
24 def prune(orig, self, revlog, missing, commonrevs):
33 def prune(orig, self, revlog, missing, commonrevs):
25 if isinstance(revlog, manifest.manifestrevlog):
34 if isinstance(revlog, manifest.manifestrevlog):
26 matcher = getattr(self._repo, 'narrowmatch',
35 matcher = _cgmatcher(self)
27 getattr(self, '_narrow_matcher', None))
36 if (matcher and
28 if (matcher is not None and
37 not matcher.visitdir(revlog._dir[:-1] or '.')):
29 not matcher().visitdir(revlog._dir[:-1] or '.')):
30 return []
38 return []
31 return orig(self, revlog, missing, commonrevs)
39 return orig(self, revlog, missing, commonrevs)
32
40
@@ -34,11 +42,9 b' def setup():'
34
42
35 def generatefiles(orig, self, changedfiles, linknodes, commonrevs,
43 def generatefiles(orig, self, changedfiles, linknodes, commonrevs,
36 source):
44 source):
37 matcher = getattr(self._repo, 'narrowmatch',
45 matcher = _cgmatcher(self)
38 getattr(self, '_narrow_matcher', None))
46 if matcher:
39 if matcher is not None:
47 changedfiles = filter(matcher, changedfiles)
40 narrowmatch = matcher()
41 changedfiles = [f for f in changedfiles if narrowmatch(f)]
42 if getattr(self, 'is_shallow', False):
48 if getattr(self, 'is_shallow', False):
43 # See comment in generate() for why this sadness is a thing.
49 # See comment in generate() for why this sadness is a thing.
44 mfdicts = self._mfdicts
50 mfdicts = self._mfdicts
@@ -137,13 +137,12 b' narrow spec'
137 $ hg pull ssh://user@dummy/narrow2
137 $ hg pull ssh://user@dummy/narrow2
138 pulling from ssh://user@dummy/narrow2
138 pulling from ssh://user@dummy/narrow2
139 searching for changes
139 searching for changes
140 remote: abort: unable to resolve parent while packing 'data/inside2/f.i' 3 for changeset 5 (?)
141 adding changesets
140 adding changesets
142 remote: abort: unexpected error: unable to resolve parent while packing 'data/inside2/f.i' 3 for changeset 5
141 adding manifests
143 transaction abort!
142 adding file changes
144 rollback completed
143 added 1 changesets with 0 changes to 0 files
145 abort: pull failed on remote
144 new changesets d78a96df731d
146 [255]
145 (run 'hg update' to get a working copy)
147
146
148 Check that the resulting history is valid in the full repo
147 Check that the resulting history is valid in the full repo
149
148
@@ -204,7 +203,7 b' necessary content to be able to push to '
204 $ hg push ssh://user@dummy/narrow2
203 $ hg push ssh://user@dummy/narrow2
205 pushing to ssh://user@dummy/narrow2
204 pushing to ssh://user@dummy/narrow2
206 searching for changes
205 searching for changes
207 remote has heads on branch 'default' that are not known locally: d78a96df731d
206 remote: adding changesets
208 abort: push creates new remote head 5970befb64ba!
207 remote: adding manifests
209 (pull and merge or see 'hg help push' for details about pushing new heads)
208 remote: adding file changes
210 [255]
209 remote: added 1 changesets with 0 changes to 0 files
General Comments 0
You need to be logged in to leave comments. Login now