Mercurial > hg
annotate hgext/narrow/narrowcopies.py @ 37416:7542e97c7867
tests: conditionalize tests for various repo features
Working my down the long tail of test failures due to the simple
store.
We're now down to 38 failures with the simple store.
Differential Revision: https://phab.mercurial-scm.org/D3096
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 04 Apr 2018 14:04:18 -0700 |
parents | d0d5eef57fb0 |
children |
rev | line source |
---|---|
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 # narrowcopies.py - extensions to mercurial copies module to support narrow |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 # clones |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 # |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 # Copyright 2017 Google, Inc. |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 # |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 # This software may be used and distributed according to the terms of the |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 # GNU General Public License version 2 or any later version. |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 from __future__ import absolute_import |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
11 from mercurial import ( |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 copies, |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 extensions, |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 ) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 def setup(repo): |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 def _computeforwardmissing(orig, a, b, match=None): |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 missing = orig(a, b, match) |
36472
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
19 narrowmatch = repo.narrowmatch() |
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
20 if narrowmatch.always(): |
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
21 return missing |
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
22 missing = [f for f in missing if narrowmatch(f)] |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 return missing |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 def _checkcopies(orig, srcctx, dstctx, f, base, tca, remotebase, limit, |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 data): |
36472
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
27 narrowmatch = repo.narrowmatch() |
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
28 if not narrowmatch(f): |
d0d5eef57fb0
narrow: drop safehasattr() checks for always-present repo.narrowmatch
Martin von Zweigbergk <martinvonz@google.com>
parents:
36345
diff
changeset
|
29 return |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 orig(srcctx, dstctx, f, base, tca, remotebase, limit, data) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
32 extensions.wrapfunction(copies, '_computeforwardmissing', |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
33 _computeforwardmissing) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
34 extensions.wrapfunction(copies, '_checkcopies', _checkcopies) |