Show More
@@ -1,398 +1,403 b'' | |||||
1 | # remotenames.py - extension to display remotenames |
|
1 | # remotenames.py - extension to display remotenames | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Augie Fackler <raf@durin42.com> |
|
3 | # Copyright 2017 Augie Fackler <raf@durin42.com> | |
4 | # Copyright 2017 Sean Farley <sean@farley.io> |
|
4 | # Copyright 2017 Sean Farley <sean@farley.io> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | """ showing remotebookmarks and remotebranches in UI (EXPERIMENTAL) |
|
9 | """ showing remotebookmarks and remotebranches in UI (EXPERIMENTAL) | |
10 |
|
10 | |||
11 | By default both remotebookmarks and remotebranches are turned on. Config knob to |
|
11 | By default both remotebookmarks and remotebranches are turned on. Config knob to | |
12 | control the individually are as follows. |
|
12 | control the individually are as follows. | |
13 |
|
13 | |||
14 | Config options to tweak the default behaviour: |
|
14 | Config options to tweak the default behaviour: | |
15 |
|
15 | |||
16 | remotenames.bookmarks |
|
16 | remotenames.bookmarks | |
17 | Boolean value to enable or disable showing of remotebookmarks (default: True) |
|
17 | Boolean value to enable or disable showing of remotebookmarks (default: True) | |
18 |
|
18 | |||
19 | remotenames.branches |
|
19 | remotenames.branches | |
20 | Boolean value to enable or disable showing of remotebranches (default: True) |
|
20 | Boolean value to enable or disable showing of remotebranches (default: True) | |
21 |
|
21 | |||
22 | remotenames.hoistedpeer |
|
22 | remotenames.hoistedpeer | |
23 | Name of the peer whose remotebookmarks should be hoisted into the top-level |
|
23 | Name of the peer whose remotebookmarks should be hoisted into the top-level | |
24 | namespace (default: 'default') |
|
24 | namespace (default: 'default') | |
25 | """ |
|
25 | """ | |
26 |
|
26 | |||
27 | from __future__ import absolute_import |
|
27 | from __future__ import absolute_import | |
28 |
|
28 | |||
29 | from mercurial.i18n import _ |
|
29 | from mercurial.i18n import _ | |
30 |
|
30 | |||
31 | from mercurial.node import ( |
|
31 | from mercurial.node import ( | |
32 | bin, |
|
32 | bin, | |
33 | ) |
|
33 | ) | |
34 | from mercurial import ( |
|
34 | from mercurial import ( | |
35 | bookmarks, |
|
35 | bookmarks, | |
|
36 | error, | |||
36 | extensions, |
|
37 | extensions, | |
37 | logexchange, |
|
38 | logexchange, | |
38 | namespaces, |
|
39 | namespaces, | |
39 | pycompat, |
|
40 | pycompat, | |
40 | registrar, |
|
41 | registrar, | |
41 | revsetlang, |
|
42 | revsetlang, | |
42 | smartset, |
|
43 | smartset, | |
43 | templateutil, |
|
44 | templateutil, | |
44 | util, |
|
45 | util, | |
45 | ) |
|
46 | ) | |
46 |
|
47 | |||
47 | from mercurial.utils import ( |
|
48 | from mercurial.utils import ( | |
48 | stringutil, |
|
49 | stringutil, | |
49 | ) |
|
50 | ) | |
50 |
|
51 | |||
51 | if pycompat.ispy3: |
|
52 | if pycompat.ispy3: | |
52 | import collections.abc |
|
53 | import collections.abc | |
53 | mutablemapping = collections.abc.MutableMapping |
|
54 | mutablemapping = collections.abc.MutableMapping | |
54 | else: |
|
55 | else: | |
55 | import collections |
|
56 | import collections | |
56 | mutablemapping = collections.MutableMapping |
|
57 | mutablemapping = collections.MutableMapping | |
57 |
|
58 | |||
58 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
59 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
59 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
60 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
60 | # be specifying the version(s) of Mercurial they are tested with, or |
|
61 | # be specifying the version(s) of Mercurial they are tested with, or | |
61 | # leave the attribute unspecified. |
|
62 | # leave the attribute unspecified. | |
62 | testedwith = 'ships-with-hg-core' |
|
63 | testedwith = 'ships-with-hg-core' | |
63 |
|
64 | |||
64 | configtable = {} |
|
65 | configtable = {} | |
65 | configitem = registrar.configitem(configtable) |
|
66 | configitem = registrar.configitem(configtable) | |
66 | templatekeyword = registrar.templatekeyword() |
|
67 | templatekeyword = registrar.templatekeyword() | |
67 | revsetpredicate = registrar.revsetpredicate() |
|
68 | revsetpredicate = registrar.revsetpredicate() | |
68 |
|
69 | |||
69 | configitem('remotenames', 'bookmarks', |
|
70 | configitem('remotenames', 'bookmarks', | |
70 | default=True, |
|
71 | default=True, | |
71 | ) |
|
72 | ) | |
72 | configitem('remotenames', 'branches', |
|
73 | configitem('remotenames', 'branches', | |
73 | default=True, |
|
74 | default=True, | |
74 | ) |
|
75 | ) | |
75 | configitem('remotenames', 'hoistedpeer', |
|
76 | configitem('remotenames', 'hoistedpeer', | |
76 | default='default', |
|
77 | default='default', | |
77 | ) |
|
78 | ) | |
78 |
|
79 | |||
79 | class lazyremotenamedict(mutablemapping): |
|
80 | class lazyremotenamedict(mutablemapping): | |
80 | """ |
|
81 | """ | |
81 | Read-only dict-like Class to lazily resolve remotename entries |
|
82 | Read-only dict-like Class to lazily resolve remotename entries | |
82 |
|
83 | |||
83 | We are doing that because remotenames startup was slow. |
|
84 | We are doing that because remotenames startup was slow. | |
84 | We lazily read the remotenames file once to figure out the potential entries |
|
85 | We lazily read the remotenames file once to figure out the potential entries | |
85 | and store them in self.potentialentries. Then when asked to resolve an |
|
86 | and store them in self.potentialentries. Then when asked to resolve an | |
86 | entry, if it is not in self.potentialentries, then it isn't there, if it |
|
87 | entry, if it is not in self.potentialentries, then it isn't there, if it | |
87 | is in self.potentialentries we resolve it and store the result in |
|
88 | is in self.potentialentries we resolve it and store the result in | |
88 | self.cache. We cannot be lazy is when asked all the entries (keys). |
|
89 | self.cache. We cannot be lazy is when asked all the entries (keys). | |
89 | """ |
|
90 | """ | |
90 | def __init__(self, kind, repo): |
|
91 | def __init__(self, kind, repo): | |
91 | self.cache = {} |
|
92 | self.cache = {} | |
92 | self.potentialentries = {} |
|
93 | self.potentialentries = {} | |
93 | self._kind = kind # bookmarks or branches |
|
94 | self._kind = kind # bookmarks or branches | |
94 | self._repo = repo |
|
95 | self._repo = repo | |
95 | self.loaded = False |
|
96 | self.loaded = False | |
96 |
|
97 | |||
97 | def _load(self): |
|
98 | def _load(self): | |
98 | """ Read the remotenames file, store entries matching selected kind """ |
|
99 | """ Read the remotenames file, store entries matching selected kind """ | |
99 | self.loaded = True |
|
100 | self.loaded = True | |
100 | repo = self._repo |
|
101 | repo = self._repo | |
101 | for node, rpath, rname in logexchange.readremotenamefile(repo, |
|
102 | for node, rpath, rname in logexchange.readremotenamefile(repo, | |
102 | self._kind): |
|
103 | self._kind): | |
103 | name = rpath + '/' + rname |
|
104 | name = rpath + '/' + rname | |
104 | self.potentialentries[name] = (node, rpath, name) |
|
105 | self.potentialentries[name] = (node, rpath, name) | |
105 |
|
106 | |||
106 | def _resolvedata(self, potentialentry): |
|
107 | def _resolvedata(self, potentialentry): | |
107 | """ Check that the node for potentialentry exists and return it """ |
|
108 | """ Check that the node for potentialentry exists and return it """ | |
108 | if not potentialentry in self.potentialentries: |
|
109 | if not potentialentry in self.potentialentries: | |
109 | return None |
|
110 | return None | |
110 | node, remote, name = self.potentialentries[potentialentry] |
|
111 | node, remote, name = self.potentialentries[potentialentry] | |
111 | repo = self._repo |
|
112 | repo = self._repo | |
112 | binnode = bin(node) |
|
113 | binnode = bin(node) | |
113 | # if the node doesn't exist, skip it |
|
114 | # if the node doesn't exist, skip it | |
114 | try: |
|
115 | try: | |
115 | repo.changelog.rev(binnode) |
|
116 | repo.changelog.rev(binnode) | |
116 | except LookupError: |
|
117 | except LookupError: | |
117 | return None |
|
118 | return None | |
118 | # Skip closed branches |
|
119 | # Skip closed branches | |
119 | if (self._kind == 'branches' and repo[binnode].closesbranch()): |
|
120 | if (self._kind == 'branches' and repo[binnode].closesbranch()): | |
120 | return None |
|
121 | return None | |
121 | return [binnode] |
|
122 | return [binnode] | |
122 |
|
123 | |||
123 | def __getitem__(self, key): |
|
124 | def __getitem__(self, key): | |
124 | if not self.loaded: |
|
125 | if not self.loaded: | |
125 | self._load() |
|
126 | self._load() | |
126 | val = self._fetchandcache(key) |
|
127 | val = self._fetchandcache(key) | |
127 | if val is not None: |
|
128 | if val is not None: | |
128 | return val |
|
129 | return val | |
129 | else: |
|
130 | else: | |
130 | raise KeyError() |
|
131 | raise KeyError() | |
131 |
|
132 | |||
132 | def __iter__(self): |
|
133 | def __iter__(self): | |
133 | return iter(self.potentialentries) |
|
134 | return iter(self.potentialentries) | |
134 |
|
135 | |||
135 | def __len__(self): |
|
136 | def __len__(self): | |
136 | return len(self.potentialentries) |
|
137 | return len(self.potentialentries) | |
137 |
|
138 | |||
138 | def __setitem__(self): |
|
139 | def __setitem__(self): | |
139 | raise NotImplementedError |
|
140 | raise NotImplementedError | |
140 |
|
141 | |||
141 | def __delitem__(self): |
|
142 | def __delitem__(self): | |
142 | raise NotImplementedError |
|
143 | raise NotImplementedError | |
143 |
|
144 | |||
144 | def _fetchandcache(self, key): |
|
145 | def _fetchandcache(self, key): | |
145 | if key in self.cache: |
|
146 | if key in self.cache: | |
146 | return self.cache[key] |
|
147 | return self.cache[key] | |
147 | val = self._resolvedata(key) |
|
148 | val = self._resolvedata(key) | |
148 | if val is not None: |
|
149 | if val is not None: | |
149 | self.cache[key] = val |
|
150 | self.cache[key] = val | |
150 | return val |
|
151 | return val | |
151 | else: |
|
152 | else: | |
152 | return None |
|
153 | return None | |
153 |
|
154 | |||
154 | def keys(self): |
|
155 | def keys(self): | |
155 | """ Get a list of bookmark or branch names """ |
|
156 | """ Get a list of bookmark or branch names """ | |
156 | if not self.loaded: |
|
157 | if not self.loaded: | |
157 | self._load() |
|
158 | self._load() | |
158 | return self.potentialentries.keys() |
|
159 | return self.potentialentries.keys() | |
159 |
|
160 | |||
160 | def iteritems(self): |
|
161 | def iteritems(self): | |
161 | """ Iterate over (name, node) tuples """ |
|
162 | """ Iterate over (name, node) tuples """ | |
162 |
|
163 | |||
163 | if not self.loaded: |
|
164 | if not self.loaded: | |
164 | self._load() |
|
165 | self._load() | |
165 |
|
166 | |||
166 | for k, vtup in self.potentialentries.iteritems(): |
|
167 | for k, vtup in self.potentialentries.iteritems(): | |
167 | yield (k, [bin(vtup[0])]) |
|
168 | yield (k, [bin(vtup[0])]) | |
168 |
|
169 | |||
169 | class remotenames(object): |
|
170 | class remotenames(object): | |
170 | """ |
|
171 | """ | |
171 | This class encapsulates all the remotenames state. It also contains |
|
172 | This class encapsulates all the remotenames state. It also contains | |
172 | methods to access that state in convenient ways. Remotenames are lazy |
|
173 | methods to access that state in convenient ways. Remotenames are lazy | |
173 | loaded. Whenever client code needs to ensure the freshest copy of |
|
174 | loaded. Whenever client code needs to ensure the freshest copy of | |
174 | remotenames, use the `clearnames` method to force an eventual load. |
|
175 | remotenames, use the `clearnames` method to force an eventual load. | |
175 | """ |
|
176 | """ | |
176 |
|
177 | |||
177 | def __init__(self, repo, *args): |
|
178 | def __init__(self, repo, *args): | |
178 | self._repo = repo |
|
179 | self._repo = repo | |
179 | self.clearnames() |
|
180 | self.clearnames() | |
180 |
|
181 | |||
181 | def clearnames(self): |
|
182 | def clearnames(self): | |
182 | """ Clear all remote names state """ |
|
183 | """ Clear all remote names state """ | |
183 | self.bookmarks = lazyremotenamedict("bookmarks", self._repo) |
|
184 | self.bookmarks = lazyremotenamedict("bookmarks", self._repo) | |
184 | self.branches = lazyremotenamedict("branches", self._repo) |
|
185 | self.branches = lazyremotenamedict("branches", self._repo) | |
185 | self._invalidatecache() |
|
186 | self._invalidatecache() | |
186 |
|
187 | |||
187 | def _invalidatecache(self): |
|
188 | def _invalidatecache(self): | |
188 | self._nodetobmarks = None |
|
189 | self._nodetobmarks = None | |
189 | self._nodetobranch = None |
|
190 | self._nodetobranch = None | |
190 | self._hoisttonodes = None |
|
191 | self._hoisttonodes = None | |
191 | self._nodetohoists = None |
|
192 | self._nodetohoists = None | |
192 |
|
193 | |||
193 | def bmarktonodes(self): |
|
194 | def bmarktonodes(self): | |
194 | return self.bookmarks |
|
195 | return self.bookmarks | |
195 |
|
196 | |||
196 | def nodetobmarks(self): |
|
197 | def nodetobmarks(self): | |
197 | if not self._nodetobmarks: |
|
198 | if not self._nodetobmarks: | |
198 | bmarktonodes = self.bmarktonodes() |
|
199 | bmarktonodes = self.bmarktonodes() | |
199 | self._nodetobmarks = {} |
|
200 | self._nodetobmarks = {} | |
200 | for name, node in bmarktonodes.iteritems(): |
|
201 | for name, node in bmarktonodes.iteritems(): | |
201 | self._nodetobmarks.setdefault(node[0], []).append(name) |
|
202 | self._nodetobmarks.setdefault(node[0], []).append(name) | |
202 | return self._nodetobmarks |
|
203 | return self._nodetobmarks | |
203 |
|
204 | |||
204 | def branchtonodes(self): |
|
205 | def branchtonodes(self): | |
205 | return self.branches |
|
206 | return self.branches | |
206 |
|
207 | |||
207 | def nodetobranch(self): |
|
208 | def nodetobranch(self): | |
208 | if not self._nodetobranch: |
|
209 | if not self._nodetobranch: | |
209 | branchtonodes = self.branchtonodes() |
|
210 | branchtonodes = self.branchtonodes() | |
210 | self._nodetobranch = {} |
|
211 | self._nodetobranch = {} | |
211 | for name, nodes in branchtonodes.iteritems(): |
|
212 | for name, nodes in branchtonodes.iteritems(): | |
212 | for node in nodes: |
|
213 | for node in nodes: | |
213 | self._nodetobranch.setdefault(node, []).append(name) |
|
214 | self._nodetobranch.setdefault(node, []).append(name) | |
214 | return self._nodetobranch |
|
215 | return self._nodetobranch | |
215 |
|
216 | |||
216 | def hoisttonodes(self, hoist): |
|
217 | def hoisttonodes(self, hoist): | |
217 | if not self._hoisttonodes: |
|
218 | if not self._hoisttonodes: | |
218 | marktonodes = self.bmarktonodes() |
|
219 | marktonodes = self.bmarktonodes() | |
219 | self._hoisttonodes = {} |
|
220 | self._hoisttonodes = {} | |
220 | hoist += '/' |
|
221 | hoist += '/' | |
221 | for name, node in marktonodes.iteritems(): |
|
222 | for name, node in marktonodes.iteritems(): | |
222 | if name.startswith(hoist): |
|
223 | if name.startswith(hoist): | |
223 | name = name[len(hoist):] |
|
224 | name = name[len(hoist):] | |
224 | self._hoisttonodes[name] = node |
|
225 | self._hoisttonodes[name] = node | |
225 | return self._hoisttonodes |
|
226 | return self._hoisttonodes | |
226 |
|
227 | |||
227 | def nodetohoists(self, hoist): |
|
228 | def nodetohoists(self, hoist): | |
228 | if not self._nodetohoists: |
|
229 | if not self._nodetohoists: | |
229 | marktonodes = self.bmarktonodes() |
|
230 | marktonodes = self.bmarktonodes() | |
230 | self._nodetohoists = {} |
|
231 | self._nodetohoists = {} | |
231 | hoist += '/' |
|
232 | hoist += '/' | |
232 | for name, node in marktonodes.iteritems(): |
|
233 | for name, node in marktonodes.iteritems(): | |
233 | if name.startswith(hoist): |
|
234 | if name.startswith(hoist): | |
234 | name = name[len(hoist):] |
|
235 | name = name[len(hoist):] | |
235 | self._nodetohoists.setdefault(node[0], []).append(name) |
|
236 | self._nodetohoists.setdefault(node[0], []).append(name) | |
236 | return self._nodetohoists |
|
237 | return self._nodetohoists | |
237 |
|
238 | |||
238 | def wrapprintbookmarks(orig, ui, repo, fm, bmarks): |
|
239 | def wrapprintbookmarks(orig, ui, repo, fm, bmarks): | |
239 | if 'remotebookmarks' not in repo.names: |
|
240 | if 'remotebookmarks' not in repo.names: | |
240 | return |
|
241 | return | |
241 | ns = repo.names['remotebookmarks'] |
|
242 | ns = repo.names['remotebookmarks'] | |
242 |
|
243 | |||
243 | for name in ns.listnames(repo): |
|
244 | for name in ns.listnames(repo): | |
244 | nodes = ns.nodes(repo, name) |
|
245 | nodes = ns.nodes(repo, name) | |
245 | if not nodes: |
|
246 | if not nodes: | |
246 | continue |
|
247 | continue | |
247 | node = nodes[0] |
|
248 | node = nodes[0] | |
248 |
|
249 | |||
249 | bmarks[name] = (node, ' ', '') |
|
250 | bmarks[name] = (node, ' ', '') | |
250 |
|
251 | |||
251 | return orig(ui, repo, fm, bmarks) |
|
252 | return orig(ui, repo, fm, bmarks) | |
252 |
|
253 | |||
253 | def extsetup(ui): |
|
254 | def extsetup(ui): | |
254 | extensions.wrapfunction(bookmarks, '_printbookmarks', wrapprintbookmarks) |
|
255 | extensions.wrapfunction(bookmarks, '_printbookmarks', wrapprintbookmarks) | |
255 |
|
256 | |||
256 | def reposetup(ui, repo): |
|
257 | def reposetup(ui, repo): | |
257 |
|
258 | |||
258 | # set the config option to store remotenames |
|
259 | # set the config option to store remotenames | |
259 | repo.ui.setconfig('experimental', 'remotenames', True, 'remotenames-ext') |
|
260 | repo.ui.setconfig('experimental', 'remotenames', True, 'remotenames-ext') | |
260 |
|
261 | |||
261 | if not repo.local(): |
|
262 | if not repo.local(): | |
262 | return |
|
263 | return | |
263 |
|
264 | |||
264 | repo._remotenames = remotenames(repo) |
|
265 | repo._remotenames = remotenames(repo) | |
265 | ns = namespaces.namespace |
|
266 | ns = namespaces.namespace | |
266 |
|
267 | |||
267 | if ui.configbool('remotenames', 'bookmarks'): |
|
268 | if ui.configbool('remotenames', 'bookmarks'): | |
268 | remotebookmarkns = ns( |
|
269 | remotebookmarkns = ns( | |
269 | 'remotebookmarks', |
|
270 | 'remotebookmarks', | |
270 | templatename='remotebookmarks', |
|
271 | templatename='remotebookmarks', | |
271 | colorname='remotebookmark', |
|
272 | colorname='remotebookmark', | |
272 | logfmt='remote bookmark: %s\n', |
|
273 | logfmt='remote bookmark: %s\n', | |
273 | listnames=lambda repo: repo._remotenames.bmarktonodes().keys(), |
|
274 | listnames=lambda repo: repo._remotenames.bmarktonodes().keys(), | |
274 | namemap=lambda repo, name: |
|
275 | namemap=lambda repo, name: | |
275 | repo._remotenames.bmarktonodes().get(name, []), |
|
276 | repo._remotenames.bmarktonodes().get(name, []), | |
276 | nodemap=lambda repo, node: |
|
277 | nodemap=lambda repo, node: | |
277 | repo._remotenames.nodetobmarks().get(node, [])) |
|
278 | repo._remotenames.nodetobmarks().get(node, [])) | |
278 | repo.names.addnamespace(remotebookmarkns) |
|
279 | repo.names.addnamespace(remotebookmarkns) | |
279 |
|
280 | |||
280 | # hoisting only works if there are remote bookmarks |
|
281 | # hoisting only works if there are remote bookmarks | |
281 | hoist = ui.config('remotenames', 'hoistedpeer') |
|
282 | hoist = ui.config('remotenames', 'hoistedpeer') | |
282 | if hoist: |
|
283 | if hoist: | |
283 | hoistednamens = ns( |
|
284 | hoistednamens = ns( | |
284 | 'hoistednames', |
|
285 | 'hoistednames', | |
285 | templatename='hoistednames', |
|
286 | templatename='hoistednames', | |
286 | colorname='hoistedname', |
|
287 | colorname='hoistedname', | |
287 | logfmt='hoisted name: %s\n', |
|
288 | logfmt='hoisted name: %s\n', | |
288 | listnames = lambda repo: |
|
289 | listnames = lambda repo: | |
289 | repo._remotenames.hoisttonodes(hoist).keys(), |
|
290 | repo._remotenames.hoisttonodes(hoist).keys(), | |
290 | namemap = lambda repo, name: |
|
291 | namemap = lambda repo, name: | |
291 | repo._remotenames.hoisttonodes(hoist).get(name, []), |
|
292 | repo._remotenames.hoisttonodes(hoist).get(name, []), | |
292 | nodemap = lambda repo, node: |
|
293 | nodemap = lambda repo, node: | |
293 | repo._remotenames.nodetohoists(hoist).get(node, [])) |
|
294 | repo._remotenames.nodetohoists(hoist).get(node, [])) | |
294 | repo.names.addnamespace(hoistednamens) |
|
295 | repo.names.addnamespace(hoistednamens) | |
295 |
|
296 | |||
296 | if ui.configbool('remotenames', 'branches'): |
|
297 | if ui.configbool('remotenames', 'branches'): | |
297 | remotebranchns = ns( |
|
298 | remotebranchns = ns( | |
298 | 'remotebranches', |
|
299 | 'remotebranches', | |
299 | templatename='remotebranches', |
|
300 | templatename='remotebranches', | |
300 | colorname='remotebranch', |
|
301 | colorname='remotebranch', | |
301 | logfmt='remote branch: %s\n', |
|
302 | logfmt='remote branch: %s\n', | |
302 | listnames = lambda repo: repo._remotenames.branchtonodes().keys(), |
|
303 | listnames = lambda repo: repo._remotenames.branchtonodes().keys(), | |
303 | namemap = lambda repo, name: |
|
304 | namemap = lambda repo, name: | |
304 | repo._remotenames.branchtonodes().get(name, []), |
|
305 | repo._remotenames.branchtonodes().get(name, []), | |
305 | nodemap = lambda repo, node: |
|
306 | nodemap = lambda repo, node: | |
306 | repo._remotenames.nodetobranch().get(node, [])) |
|
307 | repo._remotenames.nodetobranch().get(node, [])) | |
307 | repo.names.addnamespace(remotebranchns) |
|
308 | repo.names.addnamespace(remotebranchns) | |
308 |
|
309 | |||
309 | @templatekeyword('remotenames', requires={'repo', 'ctx'}) |
|
310 | @templatekeyword('remotenames', requires={'repo', 'ctx'}) | |
310 | def remotenameskw(context, mapping): |
|
311 | def remotenameskw(context, mapping): | |
311 | """List of strings. Remote names associated with the changeset.""" |
|
312 | """List of strings. Remote names associated with the changeset.""" | |
312 | repo = context.resource(mapping, 'repo') |
|
313 | repo = context.resource(mapping, 'repo') | |
313 | ctx = context.resource(mapping, 'ctx') |
|
314 | ctx = context.resource(mapping, 'ctx') | |
314 |
|
315 | |||
315 | remotenames = [] |
|
316 | remotenames = [] | |
316 | if 'remotebookmarks' in repo.names: |
|
317 | if 'remotebookmarks' in repo.names: | |
317 | remotenames = repo.names['remotebookmarks'].names(repo, ctx.node()) |
|
318 | remotenames = repo.names['remotebookmarks'].names(repo, ctx.node()) | |
318 |
|
319 | |||
319 | if 'remotebranches' in repo.names: |
|
320 | if 'remotebranches' in repo.names: | |
320 | remotenames += repo.names['remotebranches'].names(repo, ctx.node()) |
|
321 | remotenames += repo.names['remotebranches'].names(repo, ctx.node()) | |
321 |
|
322 | |||
322 | return templateutil.compatlist(context, mapping, 'remotename', remotenames, |
|
323 | return templateutil.compatlist(context, mapping, 'remotename', remotenames, | |
323 | plural='remotenames') |
|
324 | plural='remotenames') | |
324 |
|
325 | |||
325 | @templatekeyword('remotebookmarks', requires={'repo', 'ctx'}) |
|
326 | @templatekeyword('remotebookmarks', requires={'repo', 'ctx'}) | |
326 | def remotebookmarkskw(context, mapping): |
|
327 | def remotebookmarkskw(context, mapping): | |
327 | """List of strings. Remote bookmarks associated with the changeset.""" |
|
328 | """List of strings. Remote bookmarks associated with the changeset.""" | |
328 | repo = context.resource(mapping, 'repo') |
|
329 | repo = context.resource(mapping, 'repo') | |
329 | ctx = context.resource(mapping, 'ctx') |
|
330 | ctx = context.resource(mapping, 'ctx') | |
330 |
|
331 | |||
331 | remotebmarks = [] |
|
332 | remotebmarks = [] | |
332 | if 'remotebookmarks' in repo.names: |
|
333 | if 'remotebookmarks' in repo.names: | |
333 | remotebmarks = repo.names['remotebookmarks'].names(repo, ctx.node()) |
|
334 | remotebmarks = repo.names['remotebookmarks'].names(repo, ctx.node()) | |
334 |
|
335 | |||
335 | return templateutil.compatlist(context, mapping, 'remotebookmark', |
|
336 | return templateutil.compatlist(context, mapping, 'remotebookmark', | |
336 | remotebmarks, plural='remotebookmarks') |
|
337 | remotebmarks, plural='remotebookmarks') | |
337 |
|
338 | |||
338 | @templatekeyword('remotebranches', requires={'repo', 'ctx'}) |
|
339 | @templatekeyword('remotebranches', requires={'repo', 'ctx'}) | |
339 | def remotebrancheskw(context, mapping): |
|
340 | def remotebrancheskw(context, mapping): | |
340 | """List of strings. Remote branches associated with the changeset.""" |
|
341 | """List of strings. Remote branches associated with the changeset.""" | |
341 | repo = context.resource(mapping, 'repo') |
|
342 | repo = context.resource(mapping, 'repo') | |
342 | ctx = context.resource(mapping, 'ctx') |
|
343 | ctx = context.resource(mapping, 'ctx') | |
343 |
|
344 | |||
344 | remotebranches = [] |
|
345 | remotebranches = [] | |
345 | if 'remotebranches' in repo.names: |
|
346 | if 'remotebranches' in repo.names: | |
346 | remotebranches = repo.names['remotebranches'].names(repo, ctx.node()) |
|
347 | remotebranches = repo.names['remotebranches'].names(repo, ctx.node()) | |
347 |
|
348 | |||
348 | return templateutil.compatlist(context, mapping, 'remotebranch', |
|
349 | return templateutil.compatlist(context, mapping, 'remotebranch', | |
349 | remotebranches, plural='remotebranches') |
|
350 | remotebranches, plural='remotebranches') | |
350 |
|
351 | |||
351 | def _revsetutil(repo, subset, x, rtypes): |
|
352 | def _revsetutil(repo, subset, x, rtypes): | |
352 | """utility function to return a set of revs based on the rtypes""" |
|
353 | """utility function to return a set of revs based on the rtypes""" | |
353 | args = revsetlang.getargs(x, 0, 1, _('only one argument accepted')) |
|
354 | args = revsetlang.getargs(x, 0, 1, _('only one argument accepted')) | |
354 | if args: |
|
355 | if args: | |
355 | kind, pattern, matcher = stringutil.stringmatcher( |
|
356 | kind, pattern, matcher = stringutil.stringmatcher( | |
356 | revsetlang.getstring(args[0], _('argument must be a string'))) |
|
357 | revsetlang.getstring(args[0], _('argument must be a string'))) | |
357 | else: |
|
358 | else: | |
|
359 | kind = pattern = None | |||
358 | matcher = util.always |
|
360 | matcher = util.always | |
359 |
|
361 | |||
360 | nodes = set() |
|
362 | nodes = set() | |
361 | cl = repo.changelog |
|
363 | cl = repo.changelog | |
362 | for rtype in rtypes: |
|
364 | for rtype in rtypes: | |
363 | if rtype in repo.names: |
|
365 | if rtype in repo.names: | |
364 | ns = repo.names[rtype] |
|
366 | ns = repo.names[rtype] | |
365 | for name in ns.listnames(repo): |
|
367 | for name in ns.listnames(repo): | |
366 | if not matcher(name): |
|
368 | if not matcher(name): | |
367 | continue |
|
369 | continue | |
368 | nodes.update(ns.nodes(repo, name)) |
|
370 | nodes.update(ns.nodes(repo, name)) | |
|
371 | if kind == 'literal' and not nodes: | |||
|
372 | raise error.RepoLookupError(_("remote name '%s' does not exist") | |||
|
373 | % pattern) | |||
369 |
|
374 | |||
370 | revs = (cl.rev(n) for n in nodes if cl.hasnode(n)) |
|
375 | revs = (cl.rev(n) for n in nodes if cl.hasnode(n)) | |
371 | return subset & smartset.baseset(revs) |
|
376 | return subset & smartset.baseset(revs) | |
372 |
|
377 | |||
373 | @revsetpredicate('remotenames([name])') |
|
378 | @revsetpredicate('remotenames([name])') | |
374 | def remotenamesrevset(repo, subset, x): |
|
379 | def remotenamesrevset(repo, subset, x): | |
375 | """All changesets which have a remotename on them. If `name` is |
|
380 | """All changesets which have a remotename on them. If `name` is | |
376 | specified, only remotenames of matching remote paths are considered. |
|
381 | specified, only remotenames of matching remote paths are considered. | |
377 |
|
382 | |||
378 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. |
|
383 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. | |
379 | """ |
|
384 | """ | |
380 | return _revsetutil(repo, subset, x, ('remotebookmarks', 'remotebranches')) |
|
385 | return _revsetutil(repo, subset, x, ('remotebookmarks', 'remotebranches')) | |
381 |
|
386 | |||
382 | @revsetpredicate('remotebranches([name])') |
|
387 | @revsetpredicate('remotebranches([name])') | |
383 | def remotebranchesrevset(repo, subset, x): |
|
388 | def remotebranchesrevset(repo, subset, x): | |
384 | """All changesets which are branch heads on remotes. If `name` is |
|
389 | """All changesets which are branch heads on remotes. If `name` is | |
385 | specified, only remotenames of matching remote paths are considered. |
|
390 | specified, only remotenames of matching remote paths are considered. | |
386 |
|
391 | |||
387 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. |
|
392 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. | |
388 | """ |
|
393 | """ | |
389 | return _revsetutil(repo, subset, x, ('remotebranches',)) |
|
394 | return _revsetutil(repo, subset, x, ('remotebranches',)) | |
390 |
|
395 | |||
391 | @revsetpredicate('remotebookmarks([name])') |
|
396 | @revsetpredicate('remotebookmarks([name])') | |
392 | def remotebmarksrevset(repo, subset, x): |
|
397 | def remotebmarksrevset(repo, subset, x): | |
393 | """All changesets which have bookmarks on remotes. If `name` is |
|
398 | """All changesets which have bookmarks on remotes. If `name` is | |
394 | specified, only remotenames of matching remote paths are considered. |
|
399 | specified, only remotenames of matching remote paths are considered. | |
395 |
|
400 | |||
396 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. |
|
401 | Pattern matching is supported for `name`. See :hg:`help revisions.patterns`. | |
397 | """ |
|
402 | """ | |
398 | return _revsetutil(repo, subset, x, ('remotebookmarks',)) |
|
403 | return _revsetutil(repo, subset, x, ('remotebookmarks',)) |
@@ -1,523 +1,533 b'' | |||||
1 | Testing the functionality to pull remotenames |
|
1 | Testing the functionality to pull remotenames | |
2 | ============================================= |
|
2 | ============================================= | |
3 |
|
3 | |||
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [ui] |
|
5 | > [ui] | |
6 | > ssh = "$PYTHON" "$TESTDIR/dummyssh" |
|
6 | > ssh = "$PYTHON" "$TESTDIR/dummyssh" | |
7 | > [alias] |
|
7 | > [alias] | |
8 | > glog = log -G -T '{rev}:{node|short} {desc}' |
|
8 | > glog = log -G -T '{rev}:{node|short} {desc}' | |
9 | > [extensions] |
|
9 | > [extensions] | |
10 | > remotenames = |
|
10 | > remotenames = | |
11 | > show = |
|
11 | > show = | |
12 | > EOF |
|
12 | > EOF | |
13 |
|
13 | |||
14 | Making a server repo |
|
14 | Making a server repo | |
15 | -------------------- |
|
15 | -------------------- | |
16 |
|
16 | |||
17 | $ hg init server |
|
17 | $ hg init server | |
18 | $ cd server |
|
18 | $ cd server | |
19 | $ for ch in a b c d e f g h; do |
|
19 | $ for ch in a b c d e f g h; do | |
20 | > echo "foo" >> $ch |
|
20 | > echo "foo" >> $ch | |
21 | > hg ci -Aqm "Added "$ch |
|
21 | > hg ci -Aqm "Added "$ch | |
22 | > done |
|
22 | > done | |
23 | $ hg glog |
|
23 | $ hg glog | |
24 | @ 7:ec2426147f0e Added h |
|
24 | @ 7:ec2426147f0e Added h | |
25 | | |
|
25 | | | |
26 | o 6:87d6d6676308 Added g |
|
26 | o 6:87d6d6676308 Added g | |
27 | | |
|
27 | | | |
28 | o 5:825660c69f0c Added f |
|
28 | o 5:825660c69f0c Added f | |
29 | | |
|
29 | | | |
30 | o 4:aa98ab95a928 Added e |
|
30 | o 4:aa98ab95a928 Added e | |
31 | | |
|
31 | | | |
32 | o 3:62615734edd5 Added d |
|
32 | o 3:62615734edd5 Added d | |
33 | | |
|
33 | | | |
34 | o 2:28ad74487de9 Added c |
|
34 | o 2:28ad74487de9 Added c | |
35 | | |
|
35 | | | |
36 | o 1:29becc82797a Added b |
|
36 | o 1:29becc82797a Added b | |
37 | | |
|
37 | | | |
38 | o 0:18d04c59bb5d Added a |
|
38 | o 0:18d04c59bb5d Added a | |
39 |
|
39 | |||
40 | $ hg bookmark -r 3 foo |
|
40 | $ hg bookmark -r 3 foo | |
41 | $ hg bookmark -r 6 bar |
|
41 | $ hg bookmark -r 6 bar | |
42 | $ hg up 4 |
|
42 | $ hg up 4 | |
43 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
43 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
44 | $ hg branch wat |
|
44 | $ hg branch wat | |
45 | marked working directory as branch wat |
|
45 | marked working directory as branch wat | |
46 | (branches are permanent and global, did you want a bookmark?) |
|
46 | (branches are permanent and global, did you want a bookmark?) | |
47 | $ echo foo >> bar |
|
47 | $ echo foo >> bar | |
48 | $ hg ci -Aqm "added bar" |
|
48 | $ hg ci -Aqm "added bar" | |
49 |
|
49 | |||
50 | Making a client repo |
|
50 | Making a client repo | |
51 | -------------------- |
|
51 | -------------------- | |
52 |
|
52 | |||
53 | $ cd .. |
|
53 | $ cd .. | |
54 |
|
54 | |||
55 | $ hg clone ssh://user@dummy/server client |
|
55 | $ hg clone ssh://user@dummy/server client | |
56 | requesting all changes |
|
56 | requesting all changes | |
57 | adding changesets |
|
57 | adding changesets | |
58 | adding manifests |
|
58 | adding manifests | |
59 | adding file changes |
|
59 | adding file changes | |
60 | added 9 changesets with 9 changes to 9 files (+1 heads) |
|
60 | added 9 changesets with 9 changes to 9 files (+1 heads) | |
61 | new changesets 18d04c59bb5d:3e1487808078 |
|
61 | new changesets 18d04c59bb5d:3e1487808078 | |
62 | updating to branch default |
|
62 | updating to branch default | |
63 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
63 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
64 |
|
64 | |||
65 | $ cd client |
|
65 | $ cd client | |
66 | $ cat .hg/logexchange/bookmarks |
|
66 | $ cat .hg/logexchange/bookmarks | |
67 | 0 |
|
67 | 0 | |
68 |
|
68 | |||
69 | 87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc) |
|
69 | 87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc) | |
70 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc) |
|
70 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc) | |
71 |
|
71 | |||
72 | $ cat .hg/logexchange/branches |
|
72 | $ cat .hg/logexchange/branches | |
73 | 0 |
|
73 | 0 | |
74 |
|
74 | |||
75 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc) |
|
75 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc) | |
76 | 3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc) |
|
76 | 3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc) | |
77 |
|
77 | |||
78 | $ hg show work |
|
78 | $ hg show work | |
79 | o 3e14 (wat) (default/wat) added bar |
|
79 | o 3e14 (wat) (default/wat) added bar | |
80 | ~ |
|
80 | ~ | |
81 | @ ec24 (default/default) Added h |
|
81 | @ ec24 (default/default) Added h | |
82 | ~ |
|
82 | ~ | |
83 |
|
83 | |||
84 | $ hg update "default/wat" |
|
84 | $ hg update "default/wat" | |
85 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
85 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
86 | $ hg identify |
|
86 | $ hg identify | |
87 | 3e1487808078 (wat) tip |
|
87 | 3e1487808078 (wat) tip | |
88 |
|
88 | |||
89 | Making a new server |
|
89 | Making a new server | |
90 | ------------------- |
|
90 | ------------------- | |
91 |
|
91 | |||
92 | $ cd .. |
|
92 | $ cd .. | |
93 | $ hg init server2 |
|
93 | $ hg init server2 | |
94 | $ cd server2 |
|
94 | $ cd server2 | |
95 | $ hg pull ../server/ |
|
95 | $ hg pull ../server/ | |
96 | pulling from ../server/ |
|
96 | pulling from ../server/ | |
97 | requesting all changes |
|
97 | requesting all changes | |
98 | adding changesets |
|
98 | adding changesets | |
99 | adding manifests |
|
99 | adding manifests | |
100 | adding file changes |
|
100 | adding file changes | |
101 | added 9 changesets with 9 changes to 9 files (+1 heads) |
|
101 | added 9 changesets with 9 changes to 9 files (+1 heads) | |
102 | adding remote bookmark bar |
|
102 | adding remote bookmark bar | |
103 | adding remote bookmark foo |
|
103 | adding remote bookmark foo | |
104 | new changesets 18d04c59bb5d:3e1487808078 |
|
104 | new changesets 18d04c59bb5d:3e1487808078 | |
105 | (run 'hg heads' to see heads) |
|
105 | (run 'hg heads' to see heads) | |
106 |
|
106 | |||
107 | Pulling form the new server |
|
107 | Pulling form the new server | |
108 | --------------------------- |
|
108 | --------------------------- | |
109 | $ cd ../client/ |
|
109 | $ cd ../client/ | |
110 | $ hg pull ../server2/ |
|
110 | $ hg pull ../server2/ | |
111 | pulling from ../server2/ |
|
111 | pulling from ../server2/ | |
112 | searching for changes |
|
112 | searching for changes | |
113 | no changes found |
|
113 | no changes found | |
114 | $ cat .hg/logexchange/bookmarks |
|
114 | $ cat .hg/logexchange/bookmarks | |
115 | 0 |
|
115 | 0 | |
116 |
|
116 | |||
117 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc) |
|
117 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc) | |
118 | 87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc) |
|
118 | 87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc) | |
119 | 87d6d66763085b629e6d7ed56778c79827273022\x00$TESTTMP/server2\x00bar (esc) |
|
119 | 87d6d66763085b629e6d7ed56778c79827273022\x00$TESTTMP/server2\x00bar (esc) | |
120 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00$TESTTMP/server2\x00foo (esc) |
|
120 | 62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00$TESTTMP/server2\x00foo (esc) | |
121 |
|
121 | |||
122 | $ cat .hg/logexchange/branches |
|
122 | $ cat .hg/logexchange/branches | |
123 | 0 |
|
123 | 0 | |
124 |
|
124 | |||
125 | 3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc) |
|
125 | 3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc) | |
126 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc) |
|
126 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc) | |
127 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00$TESTTMP/server2\x00default (esc) |
|
127 | ec2426147f0e39dbc9cef599b066be6035ce691d\x00$TESTTMP/server2\x00default (esc) | |
128 | 3e1487808078543b0af6d10dadf5d46943578db0\x00$TESTTMP/server2\x00wat (esc) |
|
128 | 3e1487808078543b0af6d10dadf5d46943578db0\x00$TESTTMP/server2\x00wat (esc) | |
129 |
|
129 | |||
130 | $ hg log -G |
|
130 | $ hg log -G | |
131 | @ changeset: 8:3e1487808078 |
|
131 | @ changeset: 8:3e1487808078 | |
132 | | branch: wat |
|
132 | | branch: wat | |
133 | | tag: tip |
|
133 | | tag: tip | |
134 | | remote branch: $TESTTMP/server2/wat |
|
134 | | remote branch: $TESTTMP/server2/wat | |
135 | | remote branch: default/wat |
|
135 | | remote branch: default/wat | |
136 | | parent: 4:aa98ab95a928 |
|
136 | | parent: 4:aa98ab95a928 | |
137 | | user: test |
|
137 | | user: test | |
138 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
138 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
139 | | summary: added bar |
|
139 | | summary: added bar | |
140 | | |
|
140 | | | |
141 | | o changeset: 7:ec2426147f0e |
|
141 | | o changeset: 7:ec2426147f0e | |
142 | | | remote branch: $TESTTMP/server2/default |
|
142 | | | remote branch: $TESTTMP/server2/default | |
143 | | | remote branch: default/default |
|
143 | | | remote branch: default/default | |
144 | | | user: test |
|
144 | | | user: test | |
145 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
145 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
146 | | | summary: Added h |
|
146 | | | summary: Added h | |
147 | | | |
|
147 | | | | |
148 | | o changeset: 6:87d6d6676308 |
|
148 | | o changeset: 6:87d6d6676308 | |
149 | | | bookmark: bar |
|
149 | | | bookmark: bar | |
150 | | | remote bookmark: $TESTTMP/server2/bar |
|
150 | | | remote bookmark: $TESTTMP/server2/bar | |
151 | | | remote bookmark: default/bar |
|
151 | | | remote bookmark: default/bar | |
152 | | | hoisted name: bar |
|
152 | | | hoisted name: bar | |
153 | | | user: test |
|
153 | | | user: test | |
154 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
154 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
155 | | | summary: Added g |
|
155 | | | summary: Added g | |
156 | | | |
|
156 | | | | |
157 | | o changeset: 5:825660c69f0c |
|
157 | | o changeset: 5:825660c69f0c | |
158 | |/ user: test |
|
158 | |/ user: test | |
159 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
159 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
160 | | summary: Added f |
|
160 | | summary: Added f | |
161 | | |
|
161 | | | |
162 | o changeset: 4:aa98ab95a928 |
|
162 | o changeset: 4:aa98ab95a928 | |
163 | | user: test |
|
163 | | user: test | |
164 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
164 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
165 | | summary: Added e |
|
165 | | summary: Added e | |
166 | | |
|
166 | | | |
167 | o changeset: 3:62615734edd5 |
|
167 | o changeset: 3:62615734edd5 | |
168 | | bookmark: foo |
|
168 | | bookmark: foo | |
169 | | remote bookmark: $TESTTMP/server2/foo |
|
169 | | remote bookmark: $TESTTMP/server2/foo | |
170 | | remote bookmark: default/foo |
|
170 | | remote bookmark: default/foo | |
171 | | hoisted name: foo |
|
171 | | hoisted name: foo | |
172 | | user: test |
|
172 | | user: test | |
173 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
173 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
174 | | summary: Added d |
|
174 | | summary: Added d | |
175 | | |
|
175 | | | |
176 | o changeset: 2:28ad74487de9 |
|
176 | o changeset: 2:28ad74487de9 | |
177 | | user: test |
|
177 | | user: test | |
178 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
178 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
179 | | summary: Added c |
|
179 | | summary: Added c | |
180 | | |
|
180 | | | |
181 | o changeset: 1:29becc82797a |
|
181 | o changeset: 1:29becc82797a | |
182 | | user: test |
|
182 | | user: test | |
183 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
183 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
184 | | summary: Added b |
|
184 | | summary: Added b | |
185 | | |
|
185 | | | |
186 | o changeset: 0:18d04c59bb5d |
|
186 | o changeset: 0:18d04c59bb5d | |
187 | user: test |
|
187 | user: test | |
188 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
188 | date: Thu Jan 01 00:00:00 1970 +0000 | |
189 | summary: Added a |
|
189 | summary: Added a | |
190 |
|
190 | |||
191 | Testing the templates provided by remotenames extension |
|
191 | Testing the templates provided by remotenames extension | |
192 |
|
192 | |||
193 | `remotenames` keyword |
|
193 | `remotenames` keyword | |
194 |
|
194 | |||
195 | $ hg log -G -T "{rev}:{node|short} {remotenames}\n" |
|
195 | $ hg log -G -T "{rev}:{node|short} {remotenames}\n" | |
196 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat |
|
196 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat | |
197 | | |
|
197 | | | |
198 | | o 7:ec2426147f0e $TESTTMP/server2/default default/default |
|
198 | | o 7:ec2426147f0e $TESTTMP/server2/default default/default | |
199 | | | |
|
199 | | | | |
200 | | o 6:87d6d6676308 $TESTTMP/server2/bar default/bar |
|
200 | | o 6:87d6d6676308 $TESTTMP/server2/bar default/bar | |
201 | | | |
|
201 | | | | |
202 | | o 5:825660c69f0c |
|
202 | | o 5:825660c69f0c | |
203 | |/ |
|
203 | |/ | |
204 | o 4:aa98ab95a928 |
|
204 | o 4:aa98ab95a928 | |
205 | | |
|
205 | | | |
206 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo |
|
206 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo | |
207 | | |
|
207 | | | |
208 | o 2:28ad74487de9 |
|
208 | o 2:28ad74487de9 | |
209 | | |
|
209 | | | |
210 | o 1:29becc82797a |
|
210 | o 1:29becc82797a | |
211 | | |
|
211 | | | |
212 | o 0:18d04c59bb5d |
|
212 | o 0:18d04c59bb5d | |
213 |
|
213 | |||
214 | `remotebookmarks` and `remotebranches` keywords |
|
214 | `remotebookmarks` and `remotebranches` keywords | |
215 |
|
215 | |||
216 | $ hg log -G -T "{rev}:{node|short} [{remotebookmarks}] ({remotebranches})" |
|
216 | $ hg log -G -T "{rev}:{node|short} [{remotebookmarks}] ({remotebranches})" | |
217 | @ 8:3e1487808078 [] ($TESTTMP/server2/wat default/wat) |
|
217 | @ 8:3e1487808078 [] ($TESTTMP/server2/wat default/wat) | |
218 | | |
|
218 | | | |
219 | | o 7:ec2426147f0e [] ($TESTTMP/server2/default default/default) |
|
219 | | o 7:ec2426147f0e [] ($TESTTMP/server2/default default/default) | |
220 | | | |
|
220 | | | | |
221 | | o 6:87d6d6676308 [$TESTTMP/server2/bar default/bar] () |
|
221 | | o 6:87d6d6676308 [$TESTTMP/server2/bar default/bar] () | |
222 | | | |
|
222 | | | | |
223 | | o 5:825660c69f0c [] () |
|
223 | | o 5:825660c69f0c [] () | |
224 | |/ |
|
224 | |/ | |
225 | o 4:aa98ab95a928 [] () |
|
225 | o 4:aa98ab95a928 [] () | |
226 | | |
|
226 | | | |
227 | o 3:62615734edd5 [$TESTTMP/server2/foo default/foo] () |
|
227 | o 3:62615734edd5 [$TESTTMP/server2/foo default/foo] () | |
228 | | |
|
228 | | | |
229 | o 2:28ad74487de9 [] () |
|
229 | o 2:28ad74487de9 [] () | |
230 | | |
|
230 | | | |
231 | o 1:29becc82797a [] () |
|
231 | o 1:29becc82797a [] () | |
232 | | |
|
232 | | | |
233 | o 0:18d04c59bb5d [] () |
|
233 | o 0:18d04c59bb5d [] () | |
234 |
|
234 | |||
235 | The `hoistednames` template keyword |
|
235 | The `hoistednames` template keyword | |
236 |
|
236 | |||
237 | $ hg log -GT "{rev}:{node|short} ({hoistednames})" |
|
237 | $ hg log -GT "{rev}:{node|short} ({hoistednames})" | |
238 | @ 8:3e1487808078 () |
|
238 | @ 8:3e1487808078 () | |
239 | | |
|
239 | | | |
240 | | o 7:ec2426147f0e () |
|
240 | | o 7:ec2426147f0e () | |
241 | | | |
|
241 | | | | |
242 | | o 6:87d6d6676308 (bar) |
|
242 | | o 6:87d6d6676308 (bar) | |
243 | | | |
|
243 | | | | |
244 | | o 5:825660c69f0c () |
|
244 | | o 5:825660c69f0c () | |
245 | |/ |
|
245 | |/ | |
246 | o 4:aa98ab95a928 () |
|
246 | o 4:aa98ab95a928 () | |
247 | | |
|
247 | | | |
248 | o 3:62615734edd5 (foo) |
|
248 | o 3:62615734edd5 (foo) | |
249 | | |
|
249 | | | |
250 | o 2:28ad74487de9 () |
|
250 | o 2:28ad74487de9 () | |
251 | | |
|
251 | | | |
252 | o 1:29becc82797a () |
|
252 | o 1:29becc82797a () | |
253 | | |
|
253 | | | |
254 | o 0:18d04c59bb5d () |
|
254 | o 0:18d04c59bb5d () | |
255 |
|
255 | |||
256 |
|
256 | |||
257 | Testing the revsets provided by remotenames extension |
|
257 | Testing the revsets provided by remotenames extension | |
258 |
|
258 | |||
259 | `remotenames` revset |
|
259 | `remotenames` revset | |
260 |
|
260 | |||
261 | $ hg log -r "remotenames()" -GT "{rev}:{node|short} {remotenames}\n" |
|
261 | $ hg log -r "remotenames()" -GT "{rev}:{node|short} {remotenames}\n" | |
262 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat |
|
262 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat | |
263 | : |
|
263 | : | |
264 | : o 7:ec2426147f0e $TESTTMP/server2/default default/default |
|
264 | : o 7:ec2426147f0e $TESTTMP/server2/default default/default | |
265 | : | |
|
265 | : | | |
266 | : o 6:87d6d6676308 $TESTTMP/server2/bar default/bar |
|
266 | : o 6:87d6d6676308 $TESTTMP/server2/bar default/bar | |
267 | :/ |
|
267 | :/ | |
268 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo |
|
268 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo | |
269 | | |
|
269 | | | |
270 | ~ |
|
270 | ~ | |
271 |
|
271 | |||
272 | `remotebranches` revset |
|
272 | `remotebranches` revset | |
273 |
|
273 | |||
274 | $ hg log -r "remotebranches()" -GT "{rev}:{node|short} {remotenames}\n" |
|
274 | $ hg log -r "remotebranches()" -GT "{rev}:{node|short} {remotenames}\n" | |
275 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat |
|
275 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat | |
276 | | |
|
276 | | | |
277 | ~ |
|
277 | ~ | |
278 | o 7:ec2426147f0e $TESTTMP/server2/default default/default |
|
278 | o 7:ec2426147f0e $TESTTMP/server2/default default/default | |
279 | | |
|
279 | | | |
280 | ~ |
|
280 | ~ | |
281 |
|
281 | |||
282 | `remotebookmarks` revset |
|
282 | `remotebookmarks` revset | |
283 |
|
283 | |||
284 | $ hg log -r "remotebookmarks()" -GT "{rev}:{node|short} {remotenames}\n" |
|
284 | $ hg log -r "remotebookmarks()" -GT "{rev}:{node|short} {remotenames}\n" | |
285 | o 6:87d6d6676308 $TESTTMP/server2/bar default/bar |
|
285 | o 6:87d6d6676308 $TESTTMP/server2/bar default/bar | |
286 | : |
|
286 | : | |
287 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo |
|
287 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo | |
288 | | |
|
288 | | | |
289 | ~ |
|
289 | ~ | |
290 |
|
290 | |||
291 | Updating to revision using hoisted name |
|
291 | Updating to revision using hoisted name | |
292 | --------------------------------------- |
|
292 | --------------------------------------- | |
293 |
|
293 | |||
294 | Deleting local bookmark to make sure we update to hoisted name only |
|
294 | Deleting local bookmark to make sure we update to hoisted name only | |
295 |
|
295 | |||
296 | $ hg bookmark -d bar |
|
296 | $ hg bookmark -d bar | |
297 |
|
297 | |||
298 | $ hg up bar |
|
298 | $ hg up bar | |
299 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
299 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
300 |
|
300 | |||
301 | $ hg log -r . |
|
301 | $ hg log -r . | |
302 | changeset: 6:87d6d6676308 |
|
302 | changeset: 6:87d6d6676308 | |
303 | remote bookmark: $TESTTMP/server2/bar |
|
303 | remote bookmark: $TESTTMP/server2/bar | |
304 | remote bookmark: default/bar |
|
304 | remote bookmark: default/bar | |
305 | hoisted name: bar |
|
305 | hoisted name: bar | |
306 | user: test |
|
306 | user: test | |
307 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
307 | date: Thu Jan 01 00:00:00 1970 +0000 | |
308 | summary: Added g |
|
308 | summary: Added g | |
309 |
|
309 | |||
310 | When both local bookmark and hoisted name exists but on different revs |
|
310 | When both local bookmark and hoisted name exists but on different revs | |
311 |
|
311 | |||
312 | $ hg up 8 |
|
312 | $ hg up 8 | |
313 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
313 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
314 |
|
314 | |||
315 | $ hg bookmark foo |
|
315 | $ hg bookmark foo | |
316 | moving bookmark 'foo' forward from 62615734edd5 |
|
316 | moving bookmark 'foo' forward from 62615734edd5 | |
317 |
|
317 | |||
318 | Local bookmark should take precedence over hoisted name |
|
318 | Local bookmark should take precedence over hoisted name | |
319 |
|
319 | |||
320 | $ hg up foo |
|
320 | $ hg up foo | |
321 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
321 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
322 |
|
322 | |||
323 | $ hg log -r . |
|
323 | $ hg log -r . | |
324 | changeset: 8:3e1487808078 |
|
324 | changeset: 8:3e1487808078 | |
325 | branch: wat |
|
325 | branch: wat | |
326 | bookmark: foo |
|
326 | bookmark: foo | |
327 | tag: tip |
|
327 | tag: tip | |
328 | remote branch: $TESTTMP/server2/wat |
|
328 | remote branch: $TESTTMP/server2/wat | |
329 | remote branch: default/wat |
|
329 | remote branch: default/wat | |
330 | parent: 4:aa98ab95a928 |
|
330 | parent: 4:aa98ab95a928 | |
331 | user: test |
|
331 | user: test | |
332 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
332 | date: Thu Jan 01 00:00:00 1970 +0000 | |
333 | summary: added bar |
|
333 | summary: added bar | |
334 |
|
334 | |||
335 | $ hg bookmarks |
|
335 | $ hg bookmarks | |
336 | $TESTTMP/server2/bar 6:87d6d6676308 |
|
336 | $TESTTMP/server2/bar 6:87d6d6676308 | |
337 | $TESTTMP/server2/foo 3:62615734edd5 |
|
337 | $TESTTMP/server2/foo 3:62615734edd5 | |
338 | default/bar 6:87d6d6676308 |
|
338 | default/bar 6:87d6d6676308 | |
339 | default/foo 3:62615734edd5 |
|
339 | default/foo 3:62615734edd5 | |
340 | * foo 8:3e1487808078 |
|
340 | * foo 8:3e1487808078 | |
341 |
|
341 | |||
342 | Testing the remotenames sychronization during `hg push` |
|
342 | Testing the remotenames sychronization during `hg push` | |
343 | ------------------------------------------------------- |
|
343 | ------------------------------------------------------- | |
344 |
|
344 | |||
345 | $ cd ../server/ |
|
345 | $ cd ../server/ | |
346 | $ hg bookmark foo |
|
346 | $ hg bookmark foo | |
347 | moving bookmark 'foo' forward from 62615734edd5 |
|
347 | moving bookmark 'foo' forward from 62615734edd5 | |
348 |
|
348 | |||
349 | After the push, default/foo should move to rev 8 |
|
349 | After the push, default/foo should move to rev 8 | |
350 | $ cd ../client/ |
|
350 | $ cd ../client/ | |
351 | $ hg push |
|
351 | $ hg push | |
352 | pushing to ssh://user@dummy/server |
|
352 | pushing to ssh://user@dummy/server | |
353 | searching for changes |
|
353 | searching for changes | |
354 | no changes found |
|
354 | no changes found | |
355 | [1] |
|
355 | [1] | |
356 | $ hg log -Gr 'remotenames()' |
|
356 | $ hg log -Gr 'remotenames()' | |
357 | @ changeset: 8:3e1487808078 |
|
357 | @ changeset: 8:3e1487808078 | |
358 | : branch: wat |
|
358 | : branch: wat | |
359 | : bookmark: foo |
|
359 | : bookmark: foo | |
360 | : tag: tip |
|
360 | : tag: tip | |
361 | : remote bookmark: default/foo |
|
361 | : remote bookmark: default/foo | |
362 | : hoisted name: foo |
|
362 | : hoisted name: foo | |
363 | : remote branch: $TESTTMP/server2/wat |
|
363 | : remote branch: $TESTTMP/server2/wat | |
364 | : remote branch: default/wat |
|
364 | : remote branch: default/wat | |
365 | : parent: 4:aa98ab95a928 |
|
365 | : parent: 4:aa98ab95a928 | |
366 | : user: test |
|
366 | : user: test | |
367 | : date: Thu Jan 01 00:00:00 1970 +0000 |
|
367 | : date: Thu Jan 01 00:00:00 1970 +0000 | |
368 | : summary: added bar |
|
368 | : summary: added bar | |
369 | : |
|
369 | : | |
370 | : o changeset: 7:ec2426147f0e |
|
370 | : o changeset: 7:ec2426147f0e | |
371 | : | remote branch: $TESTTMP/server2/default |
|
371 | : | remote branch: $TESTTMP/server2/default | |
372 | : | remote branch: default/default |
|
372 | : | remote branch: default/default | |
373 | : | user: test |
|
373 | : | user: test | |
374 | : | date: Thu Jan 01 00:00:00 1970 +0000 |
|
374 | : | date: Thu Jan 01 00:00:00 1970 +0000 | |
375 | : | summary: Added h |
|
375 | : | summary: Added h | |
376 | : | |
|
376 | : | | |
377 | : o changeset: 6:87d6d6676308 |
|
377 | : o changeset: 6:87d6d6676308 | |
378 | :/ remote bookmark: $TESTTMP/server2/bar |
|
378 | :/ remote bookmark: $TESTTMP/server2/bar | |
379 | : remote bookmark: default/bar |
|
379 | : remote bookmark: default/bar | |
380 | : hoisted name: bar |
|
380 | : hoisted name: bar | |
381 | : user: test |
|
381 | : user: test | |
382 | : date: Thu Jan 01 00:00:00 1970 +0000 |
|
382 | : date: Thu Jan 01 00:00:00 1970 +0000 | |
383 | : summary: Added g |
|
383 | : summary: Added g | |
384 | : |
|
384 | : | |
385 | o changeset: 3:62615734edd5 |
|
385 | o changeset: 3:62615734edd5 | |
386 | | remote bookmark: $TESTTMP/server2/foo |
|
386 | | remote bookmark: $TESTTMP/server2/foo | |
387 | ~ user: test |
|
387 | ~ user: test | |
388 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
388 | date: Thu Jan 01 00:00:00 1970 +0000 | |
389 | summary: Added d |
|
389 | summary: Added d | |
390 |
|
390 | |||
391 | $ hg bookmarks |
|
391 | $ hg bookmarks | |
392 | $TESTTMP/server2/bar 6:87d6d6676308 |
|
392 | $TESTTMP/server2/bar 6:87d6d6676308 | |
393 | $TESTTMP/server2/foo 3:62615734edd5 |
|
393 | $TESTTMP/server2/foo 3:62615734edd5 | |
394 | default/bar 6:87d6d6676308 |
|
394 | default/bar 6:87d6d6676308 | |
395 | default/foo 8:3e1487808078 |
|
395 | default/foo 8:3e1487808078 | |
396 | * foo 8:3e1487808078 |
|
396 | * foo 8:3e1487808078 | |
397 |
|
397 | |||
398 | Testing the names argument to remotenames, remotebranches and remotebookmarks revsets |
|
398 | Testing the names argument to remotenames, remotebranches and remotebookmarks revsets | |
399 | -------------------------------------------------------------------------------------- |
|
399 | -------------------------------------------------------------------------------------- | |
400 |
|
400 | |||
401 | $ cd .. |
|
401 | $ cd .. | |
402 | $ hg clone ssh://user@dummy/server client2 |
|
402 | $ hg clone ssh://user@dummy/server client2 | |
403 | requesting all changes |
|
403 | requesting all changes | |
404 | adding changesets |
|
404 | adding changesets | |
405 | adding manifests |
|
405 | adding manifests | |
406 | adding file changes |
|
406 | adding file changes | |
407 | added 9 changesets with 9 changes to 9 files (+1 heads) |
|
407 | added 9 changesets with 9 changes to 9 files (+1 heads) | |
408 | new changesets 18d04c59bb5d:3e1487808078 |
|
408 | new changesets 18d04c59bb5d:3e1487808078 | |
409 | updating to branch default |
|
409 | updating to branch default | |
410 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
410 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
411 | $ cd server2 |
|
411 | $ cd server2 | |
412 | $ hg up wat |
|
412 | $ hg up wat | |
413 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
413 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
414 | $ echo foo > watwat |
|
414 | $ echo foo > watwat | |
415 | $ hg ci -Aqm "added watwat" |
|
415 | $ hg ci -Aqm "added watwat" | |
416 | $ hg bookmark bar |
|
416 | $ hg bookmark bar | |
417 | abort: bookmark 'bar' already exists (use -f to force) |
|
417 | abort: bookmark 'bar' already exists (use -f to force) | |
418 | [255] |
|
418 | [255] | |
419 | $ hg up ec24 |
|
419 | $ hg up ec24 | |
420 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
420 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
421 | $ echo i > i |
|
421 | $ echo i > i | |
422 | $ hg ci -Aqm "added i" |
|
422 | $ hg ci -Aqm "added i" | |
423 |
|
423 | |||
424 | $ cd ../client2 |
|
424 | $ cd ../client2 | |
425 | $ echo "[paths]" >> .hg/hgrc |
|
425 | $ echo "[paths]" >> .hg/hgrc | |
426 | $ echo "server2 = $TESTTMP/server2" >> .hg/hgrc |
|
426 | $ echo "server2 = $TESTTMP/server2" >> .hg/hgrc | |
427 | $ hg pull server2 |
|
427 | $ hg pull server2 | |
428 | pulling from $TESTTMP/server2 |
|
428 | pulling from $TESTTMP/server2 | |
429 | searching for changes |
|
429 | searching for changes | |
430 | adding changesets |
|
430 | adding changesets | |
431 | adding manifests |
|
431 | adding manifests | |
432 | adding file changes |
|
432 | adding file changes | |
433 | added 2 changesets with 2 changes to 2 files |
|
433 | added 2 changesets with 2 changes to 2 files | |
434 | new changesets f34adec73c21:bf433e48adea |
|
434 | new changesets f34adec73c21:bf433e48adea | |
435 | (run 'hg update' to get a working copy) |
|
435 | (run 'hg update' to get a working copy) | |
436 |
|
436 | |||
437 | $ hg log -Gr 'remotenames()' -T '{rev}:{node|short} {desc}\n({remotebranches}) [{remotebookmarks}]\n\n' |
|
437 | $ hg log -Gr 'remotenames()' -T '{rev}:{node|short} {desc}\n({remotebranches}) [{remotebookmarks}]\n\n' | |
438 | o 10:bf433e48adea added i |
|
438 | o 10:bf433e48adea added i | |
439 | | (server2/default) [] |
|
439 | | (server2/default) [] | |
440 | | |
|
440 | | | |
441 | | o 9:f34adec73c21 added watwat |
|
441 | | o 9:f34adec73c21 added watwat | |
442 | | | (server2/wat) [] |
|
442 | | | (server2/wat) [] | |
443 | | | |
|
443 | | | | |
444 | | o 8:3e1487808078 added bar |
|
444 | | o 8:3e1487808078 added bar | |
445 | | : (default/wat) [default/foo] |
|
445 | | : (default/wat) [default/foo] | |
446 | | : |
|
446 | | : | |
447 | @ : 7:ec2426147f0e Added h |
|
447 | @ : 7:ec2426147f0e Added h | |
448 | | : (default/default) [] |
|
448 | | : (default/default) [] | |
449 | | : |
|
449 | | : | |
450 | o : 6:87d6d6676308 Added g |
|
450 | o : 6:87d6d6676308 Added g | |
451 | :/ () [default/bar server2/bar] |
|
451 | :/ () [default/bar server2/bar] | |
452 | : |
|
452 | : | |
453 | o 3:62615734edd5 Added d |
|
453 | o 3:62615734edd5 Added d | |
454 | | () [server2/foo] |
|
454 | | () [server2/foo] | |
455 | ~ |
|
455 | ~ | |
456 |
|
456 | |||
457 | Testing for a single remote name which exists |
|
457 | Testing for a single remote name which exists | |
458 |
|
458 | |||
459 | $ hg log -r 'remotebranches("default/wat")' -GT "{rev}:{node|short} {remotebranches}\n" |
|
459 | $ hg log -r 'remotebranches("default/wat")' -GT "{rev}:{node|short} {remotebranches}\n" | |
460 | o 8:3e1487808078 default/wat |
|
460 | o 8:3e1487808078 default/wat | |
461 | | |
|
461 | | | |
462 | ~ |
|
462 | ~ | |
463 |
|
463 | |||
464 | $ hg log -r 'remotebookmarks("server2/foo")' -GT "{rev}:{node|short} {remotebookmarks}\n" |
|
464 | $ hg log -r 'remotebookmarks("server2/foo")' -GT "{rev}:{node|short} {remotebookmarks}\n" | |
465 | o 3:62615734edd5 server2/foo |
|
465 | o 3:62615734edd5 server2/foo | |
466 | | |
|
466 | | | |
467 | ~ |
|
467 | ~ | |
468 |
|
468 | |||
469 | $ hg log -r 'remotenames("re:default")' -GT "{rev}:{node|short} {remotenames}\n" |
|
469 | $ hg log -r 'remotenames("re:default")' -GT "{rev}:{node|short} {remotenames}\n" | |
470 | o 10:bf433e48adea server2/default |
|
470 | o 10:bf433e48adea server2/default | |
471 | | |
|
471 | | | |
472 | | o 8:3e1487808078 default/foo default/wat |
|
472 | | o 8:3e1487808078 default/foo default/wat | |
473 | | | |
|
473 | | | | |
474 | | ~ |
|
474 | | ~ | |
475 | @ 7:ec2426147f0e default/default |
|
475 | @ 7:ec2426147f0e default/default | |
476 | | |
|
476 | | | |
477 | o 6:87d6d6676308 default/bar server2/bar |
|
477 | o 6:87d6d6676308 default/bar server2/bar | |
478 | | |
|
478 | | | |
479 | ~ |
|
479 | ~ | |
480 |
|
480 | |||
481 |
Testing for a |
|
481 | Testing for a literal name which does not exists, which should fail. | |
482 |
|
482 | |||
483 | $ hg log -r 'remotebranches(def)' -GT "{rev}:{node|short} {remotenames}\n" |
|
483 | $ hg log -r 'remotebranches(def)' -GT "{rev}:{node|short} {remotenames}\n" | |
|
484 | abort: remote name 'def' does not exist! | |||
|
485 | [255] | |||
484 |
|
486 | |||
485 | $ hg log -r 'remotebookmarks("server3")' -GT "{rev}:{node|short} {remotenames}\n" |
|
487 | $ hg log -r 'remotebookmarks("server3")' -GT "{rev}:{node|short} {remotenames}\n" | |
|
488 | abort: remote name 'server3' does not exist! | |||
|
489 | [255] | |||
486 |
|
490 | |||
487 | $ hg log -r 'remotenames("server3")' -GT "{rev}:{node|short} {remotenames}\n" |
|
491 | $ hg log -r 'remotenames("server3")' -GT "{rev}:{node|short} {remotenames}\n" | |
|
492 | abort: remote name 'server3' does not exist! | |||
|
493 | [255] | |||
|
494 | ||||
|
495 | Testing for a pattern which does not match anything, which shouldn't fail. | |||
|
496 | ||||
|
497 | $ hg log -r 'remotenames("re:^server3$")' | |||
488 |
|
498 | |||
489 | Testing for multiple names, which is not supported. |
|
499 | Testing for multiple names, which is not supported. | |
490 |
|
500 | |||
491 |
$ hg log -r 'remotenames("re:default", |
|
501 | $ hg log -r 'remotenames("re:default", "re:server2")' -GT "{rev}:{node|short} {remotenames}\n" | |
492 | hg: parse error: only one argument accepted |
|
502 | hg: parse error: only one argument accepted | |
493 | [255] |
|
503 | [255] | |
494 |
|
504 | |||
495 |
$ hg log -r 'remotebranches("default/wat", |
|
505 | $ hg log -r 'remotebranches("default/wat", "server2/wat")' -GT "{rev}:{node|short} {remotebranches}\n" | |
496 | hg: parse error: only one argument accepted |
|
506 | hg: parse error: only one argument accepted | |
497 | [255] |
|
507 | [255] | |
498 |
|
508 | |||
499 |
$ hg log -r 'remotebookmarks("default/foo", |
|
509 | $ hg log -r 'remotebookmarks("default/foo", "server2/foo")' -GT "{rev}:{node|short} {remotebookmarks}\n" | |
500 | hg: parse error: only one argument accepted |
|
510 | hg: parse error: only one argument accepted | |
501 | [255] |
|
511 | [255] | |
502 |
|
512 | |||
503 | Testing pattern matching |
|
513 | Testing pattern matching | |
504 |
|
514 | |||
505 |
$ hg log -r 'remotenames("re:def")' -GT "{rev}:{node|short} {remotenames}\n" |
|
515 | $ hg log -r 'remotenames("re:def")' -GT "{rev}:{node|short} {remotenames}\n" | |
506 | o 10:bf433e48adea server2/default |
|
516 | o 10:bf433e48adea server2/default | |
507 | | |
|
517 | | | |
508 | | o 8:3e1487808078 default/foo default/wat |
|
518 | | o 8:3e1487808078 default/foo default/wat | |
509 | | | |
|
519 | | | | |
510 | | ~ |
|
520 | | ~ | |
511 | @ 7:ec2426147f0e default/default |
|
521 | @ 7:ec2426147f0e default/default | |
512 | | |
|
522 | | | |
513 | o 6:87d6d6676308 default/bar server2/bar |
|
523 | o 6:87d6d6676308 default/bar server2/bar | |
514 | | |
|
524 | | | |
515 | ~ |
|
525 | ~ | |
516 |
|
526 | |||
517 |
$ hg log -r 'remotebranches("re:ser.*2")' -GT "{rev}:{node|short} {remotebranches}\n" |
|
527 | $ hg log -r 'remotebranches("re:ser.*2")' -GT "{rev}:{node|short} {remotebranches}\n" | |
518 | o 10:bf433e48adea server2/default |
|
528 | o 10:bf433e48adea server2/default | |
519 | | |
|
529 | | | |
520 | ~ |
|
530 | ~ | |
521 | o 9:f34adec73c21 server2/wat |
|
531 | o 9:f34adec73c21 server2/wat | |
522 | | |
|
532 | | | |
523 | ~ |
|
533 | ~ |
General Comments 0
You need to be logged in to leave comments.
Login now