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