equal
deleted
inserted
replaced
241 rui, path, create, intents=intents, createopts=createopts |
241 rui, path, create, intents=intents, createopts=createopts |
242 ).peer() |
242 ).peer() |
243 |
243 |
244 |
244 |
245 def defaultdest(source): |
245 def defaultdest(source): |
246 '''return default destination of clone if none is given |
246 """return default destination of clone if none is given |
247 |
247 |
248 >>> defaultdest(b'foo') |
248 >>> defaultdest(b'foo') |
249 'foo' |
249 'foo' |
250 >>> defaultdest(b'/foo/bar') |
250 >>> defaultdest(b'/foo/bar') |
251 'bar' |
251 'bar' |
255 '' |
255 '' |
256 >>> defaultdest(b'http://example.org/') |
256 >>> defaultdest(b'http://example.org/') |
257 '' |
257 '' |
258 >>> defaultdest(b'http://example.org/foo/') |
258 >>> defaultdest(b'http://example.org/foo/') |
259 'foo' |
259 'foo' |
260 ''' |
260 """ |
261 path = util.url(source).path |
261 path = util.url(source).path |
262 if not path: |
262 if not path: |
263 return b'' |
263 return b'' |
264 return os.path.basename(os.path.normpath(path)) |
264 return os.path.basename(os.path.normpath(path)) |
265 |
265 |
331 _postshareupdate(r, update, checkout=checkout) |
331 _postshareupdate(r, update, checkout=checkout) |
332 return r |
332 return r |
333 |
333 |
334 |
334 |
335 def _prependsourcehgrc(repo): |
335 def _prependsourcehgrc(repo): |
336 """ copies the source repo config and prepend it in current repo .hg/hgrc |
336 """copies the source repo config and prepend it in current repo .hg/hgrc |
337 on unshare. This is only done if the share was perfomed using share safe |
337 on unshare. This is only done if the share was perfomed using share safe |
338 method where we share config of source in shares""" |
338 method where we share config of source in shares""" |
339 srcvfs = vfsmod.vfs(repo.sharedpath) |
339 srcvfs = vfsmod.vfs(repo.sharedpath) |
340 dstvfs = vfsmod.vfs(repo.path) |
340 dstvfs = vfsmod.vfs(repo.path) |
341 |
341 |
441 continue |
441 continue |
442 _update(repo, uprev) |
442 _update(repo, uprev) |
443 |
443 |
444 |
444 |
445 def copystore(ui, srcrepo, destpath): |
445 def copystore(ui, srcrepo, destpath): |
446 '''copy files from store of srcrepo in destpath |
446 """copy files from store of srcrepo in destpath |
447 |
447 |
448 returns destlock |
448 returns destlock |
449 ''' |
449 """ |
450 destlock = None |
450 destlock = None |
451 try: |
451 try: |
452 hardlink = None |
452 hardlink = None |
453 topic = _(b'linking') if hardlink else _(b'copying') |
453 topic = _(b'linking') if hardlink else _(b'copying') |
454 with ui.makeprogress(topic, unit=_(b'files')) as progress: |
454 with ui.makeprogress(topic, unit=_(b'files')) as progress: |
515 # TODO this is batchable. |
515 # TODO this is batchable. |
516 remoterevs = [] |
516 remoterevs = [] |
517 for r in rev: |
517 for r in rev: |
518 with srcpeer.commandexecutor() as e: |
518 with srcpeer.commandexecutor() as e: |
519 remoterevs.append( |
519 remoterevs.append( |
520 e.callcommand(b'lookup', {b'key': r,}).result() |
520 e.callcommand( |
|
521 b'lookup', |
|
522 { |
|
523 b'key': r, |
|
524 }, |
|
525 ).result() |
521 ) |
526 ) |
522 revs = remoterevs |
527 revs = remoterevs |
523 |
528 |
524 # Obtain a lock before checking for or cloning the pooled repo otherwise |
529 # Obtain a lock before checking for or cloning the pooled repo otherwise |
525 # 2 clients may race creating or populating it. |
530 # 2 clients may race creating or populating it. |
749 # raises RepoLookupError if revision 0 is filtered or otherwise |
754 # raises RepoLookupError if revision 0 is filtered or otherwise |
750 # not available. If we fail to resolve, sharing is not enabled. |
755 # not available. If we fail to resolve, sharing is not enabled. |
751 try: |
756 try: |
752 with srcpeer.commandexecutor() as e: |
757 with srcpeer.commandexecutor() as e: |
753 rootnode = e.callcommand( |
758 rootnode = e.callcommand( |
754 b'lookup', {b'key': b'0',} |
759 b'lookup', |
|
760 { |
|
761 b'key': b'0', |
|
762 }, |
755 ).result() |
763 ).result() |
756 |
764 |
757 if rootnode != node.nullid: |
765 if rootnode != node.nullid: |
758 sharepath = os.path.join(sharepool, node.hex(rootnode)) |
766 sharepath = os.path.join(sharepool, node.hex(rootnode)) |
759 else: |
767 else: |
898 # TODO this is batchable. |
906 # TODO this is batchable. |
899 remoterevs = [] |
907 remoterevs = [] |
900 for rev in revs: |
908 for rev in revs: |
901 with srcpeer.commandexecutor() as e: |
909 with srcpeer.commandexecutor() as e: |
902 remoterevs.append( |
910 remoterevs.append( |
903 e.callcommand(b'lookup', {b'key': rev,}).result() |
911 e.callcommand( |
|
912 b'lookup', |
|
913 { |
|
914 b'key': rev, |
|
915 }, |
|
916 ).result() |
904 ) |
917 ) |
905 revs = remoterevs |
918 revs = remoterevs |
906 |
919 |
907 checkout = revs[0] |
920 checkout = revs[0] |
908 else: |
921 else: |
972 |
985 |
973 if update: |
986 if update: |
974 if update is not True: |
987 if update is not True: |
975 with srcpeer.commandexecutor() as e: |
988 with srcpeer.commandexecutor() as e: |
976 checkout = e.callcommand( |
989 checkout = e.callcommand( |
977 b'lookup', {b'key': update,} |
990 b'lookup', |
|
991 { |
|
992 b'key': update, |
|
993 }, |
978 ).result() |
994 ).result() |
979 |
995 |
980 uprev = None |
996 uprev = None |
981 status = None |
997 status = None |
982 if checkout is not None: |
998 if checkout is not None: |
1174 |
1190 |
1175 return ret |
1191 return ret |
1176 |
1192 |
1177 |
1193 |
1178 def merge( |
1194 def merge( |
1179 ctx, force=False, remind=True, labels=None, |
1195 ctx, |
|
1196 force=False, |
|
1197 remind=True, |
|
1198 labels=None, |
1180 ): |
1199 ): |
1181 """Branch merge with node, resolving changes. Return true if any |
1200 """Branch merge with node, resolving changes. Return true if any |
1182 unresolved conflicts.""" |
1201 unresolved conflicts.""" |
1183 repo = ctx.repo() |
1202 repo = ctx.repo() |
1184 stats = mergemod.merge(ctx, force=force, labels=labels) |
1203 stats = mergemod.merge(ctx, force=force, labels=labels) |