Mercurial > evolve
annotate hgext/directaccess.py @ 1367:0c134ca37567
directaccess: change rule from opt-in to opt-out
Before this patch we would opt-in commands for direct access and the default
filter for new repository was 'visible'.
With this patch, the default filter for new repos is
'visible-directaccess-warn'. It means that by default all the commands have
directaccess with warnings.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Tue, 16 Jun 2015 10:08:48 -0700 |
parents | 2eaa2943f9f3 |
children | c02cdb97ebfa |
rev | line source |
---|---|
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
1 """ This extension provides direct access |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
2 It is the ability to refer and access hidden sha in commands provided that you |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
3 know their value. |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
4 For example hg log -r xxx where xxx is a commit has should work whether xxx is |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
5 hidden or not as we assume that the user knows what he is doing when referring |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
6 to xxx. |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
7 """ |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
8 from mercurial import extensions |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
9 from mercurial import cmdutil |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
10 from mercurial import repoview |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
11 from mercurial import branchmap |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
12 from mercurial import revset |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
13 from mercurial import error |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
14 from mercurial import commands |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
15 from mercurial import hg |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
16 from mercurial.i18n import _ |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
17 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
18 cmdtable = {} |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
19 command = cmdutil.command(cmdtable) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
20 |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
21 # By default, all the commands have directaccess with warnings |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
22 # List of commands that have no directaccess and directaccess with no warning |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
23 directaccesslevel = [ |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
24 # 'nowarning' or 'error', (None if core) or extension name, command name |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
25 ('nowarning', None, 'update'), |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
26 ('nowarning', None, 'export'), |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
27 ('nowarning', 'evolve', 'prune'), |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
28 ] |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
29 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
30 def reposetup(ui, repo): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
31 repo._explicitaccess = set() |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
32 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
33 def _computehidden(repo): |
1363
2eaa2943f9f3
directaccess: use cached filteredrevs
Laurent Charignon <lcharignon@fb.com>
parents:
1360
diff
changeset
|
34 hidden = repoview.filterrevs(repo, 'visible') |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
35 cl = repo.changelog |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
36 dynamic = hidden & repo._explicitaccess |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
37 if dynamic: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
38 blocked = cl.ancestors(dynamic, inclusive=True) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
39 hidden = frozenset(r for r in hidden if r not in blocked) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
40 return hidden |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
41 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
42 def setupdirectaccess(): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
43 """ Add two new filtername that behave like visible to provide direct access |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
44 and direct access with warning. Wraps the commands to setup direct access """ |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
45 repoview.filtertable.update({'visible-directaccess-nowarn': _computehidden}) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
46 repoview.filtertable.update({'visible-directaccess-warn': _computehidden}) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
47 branchmap.subsettable['visible-directaccess-nowarn'] = 'visible' |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
48 branchmap.subsettable['visible-directaccess-warn'] = 'visible' |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
49 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
50 for warn, ext, cmd in directaccesslevel: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
51 try: |
1347
b00c2fe51ac8
directaccess: don't crash when evolve is not loaded
Laurent Charignon <lcharignon@fb.com>
parents:
1339
diff
changeset
|
52 cmdtable = extensions.find(ext).cmdtable if ext else commands.table |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
53 wrapper = wrapwitherror if warn == 'error' else wrapwithoutwarning |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
54 extensions.wrapcommand(cmdtable, cmd, wrapper) |
1347
b00c2fe51ac8
directaccess: don't crash when evolve is not loaded
Laurent Charignon <lcharignon@fb.com>
parents:
1339
diff
changeset
|
55 except (error.UnknownCommand, KeyError): |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
56 pass |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
57 |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
58 def wrapwitherror(orig, ui, repo, *args, **kwargs): |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
59 if repo and repo.filtername == 'visible-directaccess-warn': |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
60 repo = repo.filtered('visible') |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
61 return orig(ui, repo, *args, **kwargs) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
62 |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
63 def wrapwithoutwarning(orig, ui, repo, *args, **kwargs): |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
64 if repo and repo.filtername == 'visible-directaccess-warn': |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
65 repo = repo.filtered("visible-directaccess-nowarn") |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
66 return orig(ui, repo, *args, **kwargs) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
67 |
1360
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
68 def uisetup(ui): |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
69 """ Change ordering of extensions to ensure that directaccess extsetup comes |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
70 after the one of the extensions in the loadsafter list """ |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
71 loadsafter = ui.configlist('directaccess','loadsafter') |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
72 order = list(extensions._order) |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
73 directaccesidx = order.index('directaccess') |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
74 |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
75 # The min idx for directaccess to load after all the extensions in loadafter |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
76 minidxdirectaccess = directaccesidx |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
77 |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
78 for ext in loadsafter: |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
79 try: |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
80 minidxdirectaccess = max(minidxdirectaccess, order.index(ext)) |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
81 except ValueError: |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
82 pass # extension not loaded |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
83 |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
84 if minidxdirectaccess > directaccesidx: |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
85 order.insert(minidxdirectaccess + 1, 'directaccess') |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
86 order.remove('directaccess') |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
87 extensions._order = order |
5c13945b32fc
directaccess: add mechanism to load directaccess after some other extensions
Laurent Charignon <lcharignon@fb.com>
parents:
1347
diff
changeset
|
88 |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
89 def _repository(orig, *args, **kwargs): |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
90 """Make visible-directaccess-warn the default filter for new repos""" |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
91 repo = orig(*args, **kwargs) |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
92 return repo.filtered("visible-directaccess-warn") |
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
93 |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
94 def extsetup(ui): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
95 extensions.wrapfunction(revset, 'posttreebuilthook', _posttreebuilthook) |
1367
0c134ca37567
directaccess: change rule from opt-in to opt-out
Laurent Charignon <lcharignon@fb.com>
parents:
1363
diff
changeset
|
96 extensions.wrapfunction(hg, 'repository', _repository) |
1339
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
97 setupdirectaccess() |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
98 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
99 def gethashsymbols(tree): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
100 # Returns the list of symbols of the tree that look like hashes |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
101 # for example for the revset 3::abe3ff it will return ('abe3ff') |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
102 if not tree: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
103 return [] |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
104 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
105 if len(tree) == 2 and tree[0] == "symbol": |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
106 try: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
107 int(tree[1]) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
108 return [] |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
109 except ValueError as e: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
110 return [tree[1]] |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
111 elif len(tree) == 3: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
112 return gethashsymbols(tree[1]) + gethashsymbols(tree[2]) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
113 else: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
114 return [] |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
115 |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
116 def _posttreebuilthook(orig, tree, repo): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
117 # This is use to enabled direct hash access |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
118 # We extract the symbols that look like hashes and add them to the |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
119 # explicitaccess set |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
120 orig(tree, repo) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
121 filternm = "" |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
122 if repo is not None: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
123 filternm = repo.filtername |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
124 if filternm is not None and filternm.startswith('visible-directaccess'): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
125 prelength = len(repo._explicitaccess) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
126 accessbefore = set(repo._explicitaccess) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
127 repo.symbols = gethashsymbols(tree) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
128 cl = repo.unfiltered().changelog |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
129 for node in repo.symbols: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
130 try: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
131 node = cl._partialmatch(node) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
132 except error.LookupError: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
133 node = None |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
134 if node is not None: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
135 rev = cl.rev(node) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
136 if rev not in repo.changelog: |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
137 repo._explicitaccess.add(rev) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
138 if prelength != len(repo._explicitaccess): |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
139 if repo.filtername != 'visible-directaccess-nowarn': |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
140 unhiddencommits = repo._explicitaccess - accessbefore |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
141 repo.ui.warn( _("Warning: accessing hidden changesets %s " |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
142 "for write operation\n") % |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
143 (",".join([str(repo.unfiltered()[l]) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
144 for l in unhiddencommits]))) |
0e2eb196923a
inhibit: create direct access extension
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
145 repo.invalidatevolatilesets() |