Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 50437:3a2df812e1c7
pull: add --remote-hidden option and pass it through peer creation
This option will allow to pull changesets that are hidden on the remote. This
is useful when looking into a changeset?s evolution history, resolving
evolution instability or mirroring a repository.
The option is best effort and will only affect the pull when it can. The option
will be ignored when it cannot be honored.
Support for each type of peer is yet to be implemented. They currently all warn
about lack of support. The warning code will get removed as peers gain
support for this option.
The option is still experimental, so we will have freedom to update the UI or
implementation before it graduates out of experimental.
Based on a changeset by Pierre-Yves David, which added the option.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Thu, 04 Apr 2019 18:07:30 +0200 |
parents | 99faa396e186 |
children | c04abc7340f1 |
comparison
equal
deleted
inserted
replaced
50436:4077d6222cf1 | 50437:3a2df812e1c7 |
---|---|
63 | 63 |
64 # shared features | 64 # shared features |
65 sharedbookmarks = b'bookmarks' | 65 sharedbookmarks = b'bookmarks' |
66 | 66 |
67 | 67 |
68 def addbranchrevs(lrepo, other, branches, revs): | 68 def addbranchrevs(lrepo, other, branches, revs, remotehidden=False): |
69 if util.safehasattr(other, 'peer'): | 69 if util.safehasattr(other, 'peer'): |
70 # a courtesy to callers using a localrepo for other | 70 # a courtesy to callers using a localrepo for other |
71 peer = other.peer() | 71 peer = other.peer(remotehidden=remotehidden) |
72 else: | 72 else: |
73 peer = other | 73 peer = other |
74 hashbranch, branches = branches | 74 hashbranch, branches = branches |
75 if not hashbranch and not branches: | 75 if not hashbranch and not branches: |
76 x = revs or None | 76 x = revs or None |
240 ) | 240 ) |
241 _setup_repo_or_peer(ui, repo, presetupfuncs=presetupfuncs) | 241 _setup_repo_or_peer(ui, repo, presetupfuncs=presetupfuncs) |
242 return repo.filtered(b'visible') | 242 return repo.filtered(b'visible') |
243 | 243 |
244 | 244 |
245 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None): | 245 def peer( |
246 uiorrepo, | |
247 opts, | |
248 path, | |
249 create=False, | |
250 intents=None, | |
251 createopts=None, | |
252 remotehidden=False, | |
253 ): | |
246 '''return a repository peer for the specified path''' | 254 '''return a repository peer for the specified path''' |
247 ui = getattr(uiorrepo, 'ui', uiorrepo) | 255 ui = getattr(uiorrepo, 'ui', uiorrepo) |
248 rui = remoteui(uiorrepo, opts) | 256 rui = remoteui(uiorrepo, opts) |
249 if util.safehasattr(path, 'url'): | 257 if util.safehasattr(path, 'url'): |
250 # this is already a urlutil.path object | 258 # this is already a urlutil.path object |
258 rui, | 266 rui, |
259 peer_path, | 267 peer_path, |
260 create, | 268 create, |
261 intents=intents, | 269 intents=intents, |
262 createopts=createopts, | 270 createopts=createopts, |
271 remotehidden=remotehidden, | |
263 ) | 272 ) |
264 _setup_repo_or_peer(rui, peer) | 273 _setup_repo_or_peer(rui, peer) |
265 else: | 274 else: |
266 # this is a repository | 275 # this is a repository |
267 repo_path = peer_path.loc # pytype: disable=attribute-error | 276 repo_path = peer_path.loc # pytype: disable=attribute-error |
272 repo_path, | 281 repo_path, |
273 create, | 282 create, |
274 intents=intents, | 283 intents=intents, |
275 createopts=createopts, | 284 createopts=createopts, |
276 ) | 285 ) |
277 peer = repo.peer(path=peer_path) | 286 peer = repo.peer(path=peer_path, remotehidden=remotehidden) |
278 return peer | 287 return peer |
279 | 288 |
280 | 289 |
281 def defaultdest(source): | 290 def defaultdest(source): |
282 """return default destination of clone if none is given | 291 """return default destination of clone if none is given |