Show More
@@ -412,7 +412,7 def histedit(ui, repo, *parent, **opts): | |||||
412 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) |
|
412 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) | |
413 |
|
413 | |||
414 | revs, checkout = hg.addbranchrevs(repo, repo, revs, None) |
|
414 | revs, checkout = hg.addbranchrevs(repo, repo, revs, None) | |
415 |
other = hg. |
|
415 | other = hg.peer(repo, opts, dest) | |
416 |
|
416 | |||
417 | if revs: |
|
417 | if revs: | |
418 | revs = [repo.lookup(rev) for rev in revs] |
|
418 | revs = [repo.lookup(rev) for rev in revs] |
@@ -22,9 +22,9 class localstore(basestore.basestore): | |||||
22 | the user cache.''' |
|
22 | the user cache.''' | |
23 |
|
23 | |||
24 | def __init__(self, ui, repo, remote): |
|
24 | def __init__(self, ui, repo, remote): | |
25 | url = os.path.join(remote.path, '.hg', lfutil.longname) |
|
25 | url = os.path.join(remote.local().path, '.hg', lfutil.longname) | |
26 | super(localstore, self).__init__(ui, repo, util.expandpath(url)) |
|
26 | super(localstore, self).__init__(ui, repo, util.expandpath(url)) | |
27 | self.remote = remote |
|
27 | self.remote = remote.local() | |
28 |
|
28 | |||
29 | def put(self, source, hash): |
|
29 | def put(self, source, hash): | |
30 | util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash))) |
|
30 | util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash))) |
@@ -722,7 +722,7 def overrideclone(orig, ui, source, dest | |||||
722 | return True |
|
722 | return True | |
723 | if opts.get('all_largefiles'): |
|
723 | if opts.get('all_largefiles'): | |
724 | sourcerepo, destrepo = result |
|
724 | sourcerepo, destrepo = result | |
725 | success, missing = lfcommands.downloadlfiles(ui, destrepo, None) |
|
725 | success, missing = lfcommands.downloadlfiles(ui, destrepo.local(), None) | |
726 | return missing != 0 |
|
726 | return missing != 0 | |
727 | return result is None |
|
727 | return result is None | |
728 |
|
728 |
@@ -2245,7 +2245,7 def clone(ui, source, dest=None, **opts) | |||||
2245 | # main repo (destination and sources) |
|
2245 | # main repo (destination and sources) | |
2246 | if dest is None: |
|
2246 | if dest is None: | |
2247 | dest = hg.defaultdest(source) |
|
2247 | dest = hg.defaultdest(source) | |
2248 |
sr = hg. |
|
2248 | sr = hg.peer(ui, opts, ui.expandpath(source)) | |
2249 |
|
2249 | |||
2250 | # patches repo (source only) |
|
2250 | # patches repo (source only) | |
2251 | if opts.get('patches'): |
|
2251 | if opts.get('patches'): | |
@@ -2253,18 +2253,19 def clone(ui, source, dest=None, **opts) | |||||
2253 | else: |
|
2253 | else: | |
2254 | patchespath = patchdir(sr) |
|
2254 | patchespath = patchdir(sr) | |
2255 | try: |
|
2255 | try: | |
2256 |
hg. |
|
2256 | hg.peer(ui, opts, patchespath) | |
2257 | except error.RepoError: |
|
2257 | except error.RepoError: | |
2258 | raise util.Abort(_('versioned patch repository not found' |
|
2258 | raise util.Abort(_('versioned patch repository not found' | |
2259 | ' (see init --mq)')) |
|
2259 | ' (see init --mq)')) | |
2260 | qbase, destrev = None, None |
|
2260 | qbase, destrev = None, None | |
2261 | if sr.local(): |
|
2261 | if sr.local(): | |
2262 | if sr.mq.applied and sr[qbase].phase() != phases.secret: |
|
2262 | repo = sr.local() | |
2263 | qbase = sr.mq.applied[0].node |
|
2263 | if repo.mq.applied and repo[qbase].phase() != phases.secret: | |
|
2264 | qbase = repo.mq.applied[0].node | |||
2264 | if not hg.islocal(dest): |
|
2265 | if not hg.islocal(dest): | |
2265 |
heads = set( |
|
2266 | heads = set(repo.heads()) | |
2266 |
destrev = list(heads.difference( |
|
2267 | destrev = list(heads.difference(repo.heads(qbase))) | |
2267 |
destrev.append( |
|
2268 | destrev.append(repo.changelog.parents(qbase)[0]) | |
2268 | elif sr.capable('lookup'): |
|
2269 | elif sr.capable('lookup'): | |
2269 | try: |
|
2270 | try: | |
2270 | qbase = sr.lookup('qbase') |
|
2271 | qbase = sr.lookup('qbase') | |
@@ -2284,13 +2285,14 def clone(ui, source, dest=None, **opts) | |||||
2284 | stream=opts.get('uncompressed')) |
|
2285 | stream=opts.get('uncompressed')) | |
2285 |
|
2286 | |||
2286 | if dr.local(): |
|
2287 | if dr.local(): | |
|
2288 | repo = dr.local() | |||
2287 | if qbase: |
|
2289 | if qbase: | |
2288 | ui.note(_('stripping applied patches from destination ' |
|
2290 | ui.note(_('stripping applied patches from destination ' | |
2289 | 'repository\n')) |
|
2291 | 'repository\n')) | |
2290 |
|
|
2292 | repo.mq.strip(repo, [qbase], update=False, backup=None) | |
2291 | if not opts.get('noupdate'): |
|
2293 | if not opts.get('noupdate'): | |
2292 | ui.note(_('updating destination repository\n')) |
|
2294 | ui.note(_('updating destination repository\n')) | |
2293 |
hg.update( |
|
2295 | hg.update(repo, repo.changelog.tip()) | |
2294 |
|
2296 | |||
2295 | @command("qcommit|qci", |
|
2297 | @command("qcommit|qci", | |
2296 | commands.table["^commit|ci"][1], |
|
2298 | commands.table["^commit|ci"][1], |
@@ -43,8 +43,6 def relink(ui, repo, origin=None, **opts | |||||
43 | raise util.Abort(_('hardlinks are not supported on this system')) |
|
43 | raise util.Abort(_('hardlinks are not supported on this system')) | |
44 | src = hg.repository(ui, ui.expandpath(origin or 'default-relink', |
|
44 | src = hg.repository(ui, ui.expandpath(origin or 'default-relink', | |
45 | origin or 'default')) |
|
45 | origin or 'default')) | |
46 | if not src.local(): |
|
|||
47 | raise util.Abort(_('must specify local origin repository')) |
|
|||
48 | ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path)) |
|
46 | ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path)) | |
49 | if repo.root == src.root: |
|
47 | if repo.root == src.root: | |
50 | ui.status(_('there is nothing to relink\n')) |
|
48 | ui.status(_('there is nothing to relink\n')) |
@@ -139,7 +139,7 class transplanter(object): | |||||
139 | continue |
|
139 | continue | |
140 | if pulls: |
|
140 | if pulls: | |
141 | if source != repo: |
|
141 | if source != repo: | |
142 | repo.pull(source, heads=pulls) |
|
142 | repo.pull(source.peer(), heads=pulls) | |
143 | merge.update(repo, pulls[-1], False, False, None) |
|
143 | merge.update(repo, pulls[-1], False, False, None) | |
144 | p1, p2 = repo.dirstate.parents() |
|
144 | p1, p2 = repo.dirstate.parents() | |
145 | pulls = [] |
|
145 | pulls = [] | |
@@ -203,7 +203,7 class transplanter(object): | |||||
203 | os.unlink(patchfile) |
|
203 | os.unlink(patchfile) | |
204 | tr.close() |
|
204 | tr.close() | |
205 | if pulls: |
|
205 | if pulls: | |
206 | repo.pull(source, heads=pulls) |
|
206 | repo.pull(source.peer(), heads=pulls) | |
207 | merge.update(repo, pulls[-1], False, False, None) |
|
207 | merge.update(repo, pulls[-1], False, False, None) | |
208 | finally: |
|
208 | finally: | |
209 | self.saveseries(revmap, merges) |
|
209 | self.saveseries(revmap, merges) | |
@@ -614,9 +614,9 def transplant(ui, repo, *revs, **opts): | |||||
614 |
|
614 | |||
615 | sourcerepo = opts.get('source') |
|
615 | sourcerepo = opts.get('source') | |
616 | if sourcerepo: |
|
616 | if sourcerepo: | |
617 |
|
|
617 | peer = hg.peer(ui, opts, ui.expandpath(sourcerepo)) | |
618 |
branches = map( |
|
618 | branches = map(peer.lookup, opts.get('branch', ())) | |
619 |
source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, |
|
619 | source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer, | |
620 | onlyheads=branches, force=True) |
|
620 | onlyheads=branches, force=True) | |
621 | else: |
|
621 | else: | |
622 | source = repo |
|
622 | source = repo |
@@ -344,8 +344,8 def getremotechanges(ui, repo, other, on | |||||
344 |
|
344 | |||
345 | bundle = None |
|
345 | bundle = None | |
346 | bundlerepo = None |
|
346 | bundlerepo = None | |
347 | localrepo = other |
|
347 | localrepo = other.local() | |
348 |
if bundlename or not |
|
348 | if bundlename or not localrepo: | |
349 | # create a bundle (uncompressed if other repo is not local) |
|
349 | # create a bundle (uncompressed if other repo is not local) | |
350 |
|
350 | |||
351 | if other.capable('getbundle'): |
|
351 | if other.capable('getbundle'): | |
@@ -356,12 +356,12 def getremotechanges(ui, repo, other, on | |||||
356 | rheads = None |
|
356 | rheads = None | |
357 | else: |
|
357 | else: | |
358 | cg = other.changegroupsubset(incoming, rheads, 'incoming') |
|
358 | cg = other.changegroupsubset(incoming, rheads, 'incoming') | |
359 |
bundletype = |
|
359 | bundletype = localrepo and "HG10BZ" or "HG10UN" | |
360 | fname = bundle = changegroup.writebundle(cg, bundlename, bundletype) |
|
360 | fname = bundle = changegroup.writebundle(cg, bundlename, bundletype) | |
361 | # keep written bundle? |
|
361 | # keep written bundle? | |
362 | if bundlename: |
|
362 | if bundlename: | |
363 | bundle = None |
|
363 | bundle = None | |
364 |
if not |
|
364 | if not localrepo: | |
365 | # use the created uncompressed bundlerepo |
|
365 | # use the created uncompressed bundlerepo | |
366 | localrepo = bundlerepo = bundlerepository(ui, repo.root, fname) |
|
366 | localrepo = bundlerepo = bundlerepository(ui, repo.root, fname) | |
367 | # this repo contains local and other now, so filter out local again |
|
367 | # this repo contains local and other now, so filter out local again |
@@ -1784,7 +1784,7 def debugdiscovery(ui, repo, remoteurl=" | |||||
1784 | # make sure tests are repeatable |
|
1784 | # make sure tests are repeatable | |
1785 | random.seed(12323) |
|
1785 | random.seed(12323) | |
1786 |
|
1786 | |||
1787 | def doit(localheads, remoteheads): |
|
1787 | def doit(localheads, remoteheads, remote=remote): | |
1788 | if opts.get('old'): |
|
1788 | if opts.get('old'): | |
1789 | if localheads: |
|
1789 | if localheads: | |
1790 | raise util.Abort('cannot use localheads with old style ' |
|
1790 | raise util.Abort('cannot use localheads with old style ' | |
@@ -3463,10 +3463,11 def identify(ui, repo, source=None, rev= | |||||
3463 |
|
3463 | |||
3464 | if source: |
|
3464 | if source: | |
3465 | source, branches = hg.parseurl(ui.expandpath(source)) |
|
3465 | source, branches = hg.parseurl(ui.expandpath(source)) | |
3466 |
|
|
3466 | peer = hg.peer(ui, opts, source) | |
3467 | revs, checkout = hg.addbranchrevs(repo, repo, branches, None) |
|
3467 | repo = peer.local() | |
3468 |
|
3468 | revs, checkout = hg.addbranchrevs(repo, peer, branches, None) | ||
3469 | if not repo.local(): |
|
3469 | ||
|
3470 | if not repo: | |||
3470 | if num or branch or tags: |
|
3471 | if num or branch or tags: | |
3471 | raise util.Abort( |
|
3472 | raise util.Abort( | |
3472 | _("can't query remote revision number, branch, or tags")) |
|
3473 | _("can't query remote revision number, branch, or tags")) | |
@@ -3475,16 +3476,16 def identify(ui, repo, source=None, rev= | |||||
3475 | if not rev: |
|
3476 | if not rev: | |
3476 | rev = "tip" |
|
3477 | rev = "tip" | |
3477 |
|
3478 | |||
3478 |
remoterev = |
|
3479 | remoterev = peer.lookup(rev) | |
3479 | if default or id: |
|
3480 | if default or id: | |
3480 | output = [hexfunc(remoterev)] |
|
3481 | output = [hexfunc(remoterev)] | |
3481 |
|
3482 | |||
3482 | def getbms(): |
|
3483 | def getbms(): | |
3483 | bms = [] |
|
3484 | bms = [] | |
3484 |
|
3485 | |||
3485 |
if 'bookmarks' in |
|
3486 | if 'bookmarks' in peer.listkeys('namespaces'): | |
3486 | hexremoterev = hex(remoterev) |
|
3487 | hexremoterev = hex(remoterev) | |
3487 |
bms = [bm for bm, bmr in |
|
3488 | bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() | |
3488 | if bmr == hexremoterev] |
|
3489 | if bmr == hexremoterev] | |
3489 |
|
3490 | |||
3490 | return bms |
|
3491 | return bms |
@@ -169,7 +169,7 def checkheads(repo, remote, outgoing, r | |||||
169 |
|
169 | |||
170 | # 2. Check for new branches on the remote. |
|
170 | # 2. Check for new branches on the remote. | |
171 | if remote.local(): |
|
171 | if remote.local(): | |
172 | remotemap = phases.visiblebranchmap(remote) |
|
172 | remotemap = phases.visiblebranchmap(remote.local()) | |
173 | else: |
|
173 | else: | |
174 | remotemap = remote.branchmap() |
|
174 | remotemap = remote.branchmap() | |
175 | newbranches = branches - set(remotemap) |
|
175 | newbranches = branches - set(remotemap) |
@@ -20,21 +20,22 def _local(path): | |||||
20 | path = util.expandpath(util.urllocalpath(path)) |
|
20 | path = util.expandpath(util.urllocalpath(path)) | |
21 | return (os.path.isfile(path) and bundlerepo or localrepo) |
|
21 | return (os.path.isfile(path) and bundlerepo or localrepo) | |
22 |
|
22 | |||
23 |
def addbranchrevs(lrepo, r |
|
23 | def addbranchrevs(lrepo, other, branches, revs): | |
|
24 | peer = other.peer() # a courtesy to callers using a localrepo for other | |||
24 | hashbranch, branches = branches |
|
25 | hashbranch, branches = branches | |
25 | if not hashbranch and not branches: |
|
26 | if not hashbranch and not branches: | |
26 | return revs or None, revs and revs[0] or None |
|
27 | return revs or None, revs and revs[0] or None | |
27 | revs = revs and list(revs) or [] |
|
28 | revs = revs and list(revs) or [] | |
28 |
if not |
|
29 | if not peer.capable('branchmap'): | |
29 | if branches: |
|
30 | if branches: | |
30 | raise util.Abort(_("remote branch lookup not supported")) |
|
31 | raise util.Abort(_("remote branch lookup not supported")) | |
31 | revs.append(hashbranch) |
|
32 | revs.append(hashbranch) | |
32 | return revs, revs[0] |
|
33 | return revs, revs[0] | |
33 |
branchmap = |
|
34 | branchmap = peer.branchmap() | |
34 |
|
35 | |||
35 | def primary(branch): |
|
36 | def primary(branch): | |
36 | if branch == '.': |
|
37 | if branch == '.': | |
37 |
if not lrepo |
|
38 | if not lrepo: | |
38 | raise util.Abort(_("dirstate branch not accessible")) |
|
39 | raise util.Abort(_("dirstate branch not accessible")) | |
39 | branch = lrepo.dirstate.branch() |
|
40 | branch = lrepo.dirstate.branch() | |
40 | if branch in branchmap: |
|
41 | if branch in branchmap: | |
@@ -88,20 +89,29 def islocal(repo): | |||||
88 | return False |
|
89 | return False | |
89 | return repo.local() |
|
90 | return repo.local() | |
90 |
|
91 | |||
91 |
def repo |
|
92 | def _peerorrepo(ui, path, create=False): | |
92 | """return a repository object for the specified path""" |
|
93 | """return a repository object for the specified path""" | |
93 |
|
|
94 | obj = _peerlookup(path).instance(ui, path, create) | |
94 |
ui = getattr( |
|
95 | ui = getattr(obj, "ui", ui) | |
95 | for name, module in extensions.extensions(): |
|
96 | for name, module in extensions.extensions(): | |
96 | hook = getattr(module, 'reposetup', None) |
|
97 | hook = getattr(module, 'reposetup', None) | |
97 | if hook: |
|
98 | if hook: | |
98 |
hook(ui, |
|
99 | hook(ui, obj) | |
|
100 | return obj | |||
|
101 | ||||
|
102 | def repository(ui, path='', create=False): | |||
|
103 | """return a repository object for the specified path""" | |||
|
104 | peer = _peerorrepo(ui, path, create) | |||
|
105 | repo = peer.local() | |||
|
106 | if not repo: | |||
|
107 | raise util.Abort(_("repository '%s' is not local") % | |||
|
108 | (path or peer.url())) | |||
99 | return repo |
|
109 | return repo | |
100 |
|
110 | |||
101 | def peer(uiorrepo, opts, path, create=False): |
|
111 | def peer(uiorrepo, opts, path, create=False): | |
102 | '''return a repository peer for the specified path''' |
|
112 | '''return a repository peer for the specified path''' | |
103 | rui = remoteui(uiorrepo, opts) |
|
113 | rui = remoteui(uiorrepo, opts) | |
104 |
return repo |
|
114 | return _peerorrepo(rui, path, create).peer() | |
105 |
|
115 | |||
106 | def defaultdest(source): |
|
116 | def defaultdest(source): | |
107 | '''return default destination of clone if none is given''' |
|
117 | '''return default destination of clone if none is given''' | |
@@ -124,7 +134,7 def share(ui, source, dest=None, update= | |||||
124 | srcrepo = repository(ui, source) |
|
134 | srcrepo = repository(ui, source) | |
125 | rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None) |
|
135 | rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None) | |
126 | else: |
|
136 | else: | |
127 | srcrepo = source |
|
137 | srcrepo = source.local() | |
128 | origsource = source = srcrepo.url() |
|
138 | origsource = source = srcrepo.url() | |
129 | checkout = None |
|
139 | checkout = None | |
130 |
|
140 | |||
@@ -213,7 +223,7 def clone(ui, peeropts, source, dest=Non | |||||
213 |
|
223 | |||
214 | Create a copy of an existing repository in a new directory. The |
|
224 | Create a copy of an existing repository in a new directory. The | |
215 | source and destination are URLs, as passed to the repository |
|
225 | source and destination are URLs, as passed to the repository | |
216 |
function. Returns a pair of repository |
|
226 | function. Returns a pair of repository peers, the source and | |
217 | newly created destination. |
|
227 | newly created destination. | |
218 |
|
228 | |||
219 | The location of the source is added to the new repository's |
|
229 | The location of the source is added to the new repository's | |
@@ -247,12 +257,12 def clone(ui, peeropts, source, dest=Non | |||||
247 | if isinstance(source, str): |
|
257 | if isinstance(source, str): | |
248 | origsource = ui.expandpath(source) |
|
258 | origsource = ui.expandpath(source) | |
249 | source, branch = parseurl(origsource, branch) |
|
259 | source, branch = parseurl(origsource, branch) | |
250 |
src |
|
260 | srcpeer = peer(ui, peeropts, source) | |
251 | else: |
|
261 | else: | |
252 | srcrepo = source |
|
262 | srcpeer = source.peer() # in case we were called with a localrepo | |
253 | branch = (None, branch or []) |
|
263 | branch = (None, branch or []) | |
254 |
origsource = source = src |
|
264 | origsource = source = srcpeer.url() | |
255 |
rev, checkout = addbranchrevs(src |
|
265 | rev, checkout = addbranchrevs(srcpeer, srcpeer, branch, rev) | |
256 |
|
266 | |||
257 | if dest is None: |
|
267 | if dest is None: | |
258 | dest = defaultdest(source) |
|
268 | dest = defaultdest(source) | |
@@ -282,6 +292,7 def clone(ui, peeropts, source, dest=Non | |||||
282 | self.rmtree(self.dir_, True) |
|
292 | self.rmtree(self.dir_, True) | |
283 |
|
293 | |||
284 | srclock = destlock = dircleanup = None |
|
294 | srclock = destlock = dircleanup = None | |
|
295 | srcrepo = srcpeer.local() | |||
285 | try: |
|
296 | try: | |
286 | abspath = origsource |
|
297 | abspath = origsource | |
287 | if islocal(origsource): |
|
298 | if islocal(origsource): | |
@@ -291,7 +302,7 def clone(ui, peeropts, source, dest=Non | |||||
291 | dircleanup = DirCleanup(dest) |
|
302 | dircleanup = DirCleanup(dest) | |
292 |
|
303 | |||
293 | copy = False |
|
304 | copy = False | |
294 |
if src |
|
305 | if srcpeer.cancopy() and islocal(dest) and not srcrepo.revs("secret()"): | |
295 | copy = not pull and not rev |
|
306 | copy = not pull and not rev | |
296 |
|
307 | |||
297 | if copy: |
|
308 | if copy: | |
@@ -326,13 +337,12 def clone(ui, peeropts, source, dest=Non | |||||
326 |
|
337 | |||
327 | # we need to re-init the repo after manually copying the data |
|
338 | # we need to re-init the repo after manually copying the data | |
328 | # into it |
|
339 | # into it | |
329 |
dest |
|
340 | destpeer = peer(ui, peeropts, dest) | |
330 | srcrepo.hook('outgoing', source='clone', |
|
341 | srcrepo.hook('outgoing', source='clone', | |
331 | node=node.hex(node.nullid)) |
|
342 | node=node.hex(node.nullid)) | |
332 | else: |
|
343 | else: | |
333 | try: |
|
344 | try: | |
334 |
dest |
|
345 | destpeer = peer(ui, peeropts, dest, create=True) | |
335 | create=True) |
|
|||
336 | except OSError, inst: |
|
346 | except OSError, inst: | |
337 | if inst.errno == errno.EEXIST: |
|
347 | if inst.errno == errno.EEXIST: | |
338 | dircleanup.close() |
|
348 | dircleanup.close() | |
@@ -342,16 +352,16 def clone(ui, peeropts, source, dest=Non | |||||
342 |
|
352 | |||
343 | revs = None |
|
353 | revs = None | |
344 | if rev: |
|
354 | if rev: | |
345 |
if not src |
|
355 | if not srcpeer.capable('lookup'): | |
346 | raise util.Abort(_("src repository does not support " |
|
356 | raise util.Abort(_("src repository does not support " | |
347 | "revision lookup and so doesn't " |
|
357 | "revision lookup and so doesn't " | |
348 | "support clone by revision")) |
|
358 | "support clone by revision")) | |
349 |
revs = [src |
|
359 | revs = [srcpeer.lookup(r) for r in rev] | |
350 | checkout = revs[0] |
|
360 | checkout = revs[0] | |
351 |
if dest |
|
361 | if destpeer.local(): | |
352 |
dest |
|
362 | destpeer.local().clone(srcpeer, heads=revs, stream=stream) | |
353 |
elif srcrepo |
|
363 | elif srcrepo: | |
354 |
srcrepo.push(dest |
|
364 | srcrepo.push(destpeer, revs=revs) | |
355 | else: |
|
365 | else: | |
356 | raise util.Abort(_("clone from remote to remote not supported")) |
|
366 | raise util.Abort(_("clone from remote to remote not supported")) | |
357 |
|
367 | |||
@@ -359,8 +369,9 def clone(ui, peeropts, source, dest=Non | |||||
359 | dircleanup.close() |
|
369 | dircleanup.close() | |
360 |
|
370 | |||
361 | # clone all bookmarks except divergent ones |
|
371 | # clone all bookmarks except divergent ones | |
362 | if destrepo.local() and srcrepo.capable("pushkey"): |
|
372 | destrepo = destpeer.local() | |
363 | rb = srcrepo.listkeys('bookmarks') |
|
373 | if destrepo and srcpeer.capable("pushkey"): | |
|
374 | rb = srcpeer.listkeys('bookmarks') | |||
364 | for k, n in rb.iteritems(): |
|
375 | for k, n in rb.iteritems(): | |
365 | try: |
|
376 | try: | |
366 | m = destrepo.lookup(n) |
|
377 | m = destrepo.lookup(n) | |
@@ -369,11 +380,11 def clone(ui, peeropts, source, dest=Non | |||||
369 | pass |
|
380 | pass | |
370 | if rb: |
|
381 | if rb: | |
371 | bookmarks.write(destrepo) |
|
382 | bookmarks.write(destrepo) | |
372 |
elif srcrepo |
|
383 | elif srcrepo and destpeer.capable("pushkey"): | |
373 | for k, n in srcrepo._bookmarks.iteritems(): |
|
384 | for k, n in srcrepo._bookmarks.iteritems(): | |
374 |
dest |
|
385 | destpeer.pushkey('bookmarks', k, '', hex(n)) | |
375 |
|
386 | |||
376 |
if destrepo |
|
387 | if destrepo: | |
377 | fp = destrepo.opener("hgrc", "w", text=True) |
|
388 | fp = destrepo.opener("hgrc", "w", text=True) | |
378 | fp.write("[paths]\n") |
|
389 | fp.write("[paths]\n") | |
379 | u = util.url(abspath) |
|
390 | u = util.url(abspath) | |
@@ -386,9 +397,7 def clone(ui, peeropts, source, dest=Non | |||||
386 |
|
397 | |||
387 | if update: |
|
398 | if update: | |
388 | if update is not True: |
|
399 | if update is not True: | |
389 | checkout = update |
|
400 | checkout = srcrepo.lookup(update) | |
390 | if srcrepo.local(): |
|
|||
391 | checkout = srcrepo.lookup(update) |
|
|||
392 | for test in (checkout, 'default', 'tip'): |
|
401 | for test in (checkout, 'default', 'tip'): | |
393 | if test is None: |
|
402 | if test is None: | |
394 | continue |
|
403 | continue | |
@@ -401,13 +410,13 def clone(ui, peeropts, source, dest=Non | |||||
401 | destrepo.ui.status(_("updating to branch %s\n") % bn) |
|
410 | destrepo.ui.status(_("updating to branch %s\n") % bn) | |
402 | _update(destrepo, uprev) |
|
411 | _update(destrepo, uprev) | |
403 |
|
412 | |||
404 |
return src |
|
413 | return srcpeer, destpeer | |
405 | finally: |
|
414 | finally: | |
406 | release(srclock, destlock) |
|
415 | release(srclock, destlock) | |
407 | if dircleanup is not None: |
|
416 | if dircleanup is not None: | |
408 | dircleanup.cleanup() |
|
417 | dircleanup.cleanup() | |
409 |
if src |
|
418 | if srcpeer is not None: | |
410 |
src |
|
419 | srcpeer.close() | |
411 |
|
420 | |||
412 | def _showstats(repo, stats): |
|
421 | def _showstats(repo, stats): | |
413 | repo.ui.status(_("%d files updated, %d files merged, " |
|
422 | repo.ui.status(_("%d files updated, %d files merged, " |
@@ -33,6 +33,9 class repository(object): | |||||
33 | def local(self): |
|
33 | def local(self): | |
34 | return False |
|
34 | return False | |
35 |
|
35 | |||
|
36 | def peer(self): | |||
|
37 | return self | |||
|
38 | ||||
36 | def cancopy(self): |
|
39 | def cancopy(self): | |
37 | return self.local() |
|
40 | return self.local() | |
38 |
|
41 |
@@ -100,7 +100,7 def findcommonheads(ui, local, remote, | |||||
100 | sample = ownheads |
|
100 | sample = ownheads | |
101 | if remote.local(): |
|
101 | if remote.local(): | |
102 | # stopgap until we have a proper localpeer that supports batch() |
|
102 | # stopgap until we have a proper localpeer that supports batch() | |
103 | srvheadhashes = phases.visibleheads(remote) |
|
103 | srvheadhashes = phases.visibleheads(remote.local()) | |
104 | yesno = remote.known(dag.externalizeall(sample)) |
|
104 | yesno = remote.known(dag.externalizeall(sample)) | |
105 | elif remote.capable('batch'): |
|
105 | elif remote.capable('batch'): | |
106 | batch = remote.batch() |
|
106 | batch = remote.batch() |
@@ -503,9 +503,10 class hgsubrepo(abstractsubrepo): | |||||
503 | % (subrelpath(self), srcurl)) |
|
503 | % (subrelpath(self), srcurl)) | |
504 | parentrepo = self._repo._subparent |
|
504 | parentrepo = self._repo._subparent | |
505 | shutil.rmtree(self._repo.path) |
|
505 | shutil.rmtree(self._repo.path) | |
506 |
other, |
|
506 | other, cloned = hg.clone(self._repo._subparent.ui, {}, | |
507 |
|
|
507 | other, self._repo.root, | |
508 |
|
|
508 | update=False) | |
|
509 | self._repo = cloned.local() | |||
509 | self._initrepo(parentrepo, source, create=True) |
|
510 | self._initrepo(parentrepo, source, create=True) | |
510 | else: |
|
511 | else: | |
511 | self._repo.ui.status(_('pulling subrepo %s from %s\n') |
|
512 | self._repo.ui.status(_('pulling subrepo %s from %s\n') |
General Comments 0
You need to be logged in to leave comments.
Login now