##// END OF EJS Templates
subrepo: create subrepos using clone instead of pull...
Martin Geisler -
r14281:ccb7240a default
parent child Browse files
Show More
@@ -342,8 +342,11 b' class hgsubrepo(abstractsubrepo):'
342 create = True
342 create = True
343 util.makedirs(root)
343 util.makedirs(root)
344 self._repo = hg.repository(r.ui, root, create=create)
344 self._repo = hg.repository(r.ui, root, create=create)
345 self._repo._subparent = r
345 self._initrepo(r, state[0], create)
346 self._repo._subsource = state[0]
346
347 def _initrepo(self, parentrepo, source, create):
348 self._repo._subparent = parentrepo
349 self._repo._subsource = source
347
350
348 if create:
351 if create:
349 fp = self._repo.opener("hgrc", "w", text=True)
352 fp = self._repo.opener("hgrc", "w", text=True)
@@ -431,10 +434,19 b' class hgsubrepo(abstractsubrepo):'
431 if revision not in self._repo:
434 if revision not in self._repo:
432 self._repo._subsource = source
435 self._repo._subsource = source
433 srcurl = _abssource(self._repo)
436 srcurl = _abssource(self._repo)
434 self._repo.ui.status(_('pulling subrepo %s from %s\n')
435 % (subrelpath(self), srcurl))
436 other = hg.repository(self._repo.ui, srcurl)
437 other = hg.repository(self._repo.ui, srcurl)
437 self._repo.pull(other)
438 if len(self._repo) == 0:
439 self._repo.ui.status(_('cloning subrepo %s from %s\n')
440 % (subrelpath(self), srcurl))
441 parentrepo = self._repo._subparent
442 shutil.rmtree(self._repo.root)
443 other, self._repo = hg.clone(self._repo._subparent.ui, other,
444 self._repo.root, update=False)
445 self._initrepo(parentrepo, source, create=True)
446 else:
447 self._repo.ui.status(_('pulling subrepo %s from %s\n')
448 % (subrelpath(self), srcurl))
449 self._repo.pull(other)
438 bookmarks.updatefromremote(self._repo.ui, self._repo, other)
450 bookmarks.updatefromremote(self._repo.ui, self._repo, other)
439
451
440 def get(self, state, overwrite=False):
452 def get(self, state, overwrite=False):
@@ -117,7 +117,7 b' test with "/" URI (issue 747) and subrep'
117 adding file changes
117 adding file changes
118 added 1 changesets with 3 changes to 3 files
118 added 1 changesets with 3 changes to 3 files
119 updating to branch default
119 updating to branch default
120 pulling subrepo sub from static-http://localhost:$HGPORT/sub
120 cloning subrepo sub from static-http://localhost:$HGPORT/sub
121 requesting all changes
121 requesting all changes
122 adding changesets
122 adding changesets
123 adding manifests
123 adding manifests
@@ -27,12 +27,7 b" Preparing the 'main' repo which depends "
27 $ echo "sub1 = ../sub1" > main/.hgsub
27 $ echo "sub1 = ../sub1" > main/.hgsub
28 $ hg clone sub1 main/sub1
28 $ hg clone sub1 main/sub1
29 updating to branch default
29 updating to branch default
30 pulling subrepo sub2 from $TESTTMP/sub2
30 cloning subrepo sub2 from $TESTTMP/sub2
31 requesting all changes
32 adding changesets
33 adding manifests
34 adding file changes
35 added 1 changesets with 1 changes to 1 files
36 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 $ hg add -R main
32 $ hg add -R main
38 adding main/.hgsub
33 adding main/.hgsub
@@ -55,18 +50,8 b' Clone main'
55
50
56 $ hg clone main cloned
51 $ hg clone main cloned
57 updating to branch default
52 updating to branch default
58 pulling subrepo sub1 from $TESTTMP/sub1
53 cloning subrepo sub1 from $TESTTMP/sub1
59 requesting all changes
54 cloning subrepo sub1/sub2 from $TESTTMP/sub2
60 adding changesets
61 adding manifests
62 adding file changes
63 added 1 changesets with 3 changes to 3 files
64 pulling subrepo sub1/sub2 from $TESTTMP/sub2
65 requesting all changes
66 adding changesets
67 adding manifests
68 adding file changes
69 added 1 changesets with 1 changes to 1 files
70 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
71
56
72 Checking cloned repo ids
57 Checking cloned repo ids
@@ -313,18 +313,8 b' Clone and test outgoing:'
313 $ cd ..
313 $ cd ..
314 $ hg clone repo repo2
314 $ hg clone repo repo2
315 updating to branch default
315 updating to branch default
316 pulling subrepo foo from $TESTTMP/repo/foo
316 cloning subrepo foo from $TESTTMP/repo/foo
317 requesting all changes
317 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
318 adding changesets
319 adding manifests
320 adding file changes
321 added 4 changesets with 7 changes to 3 files
322 pulling subrepo foo/bar from $TESTTMP/repo/foo/bar
323 requesting all changes
324 adding changesets
325 adding manifests
326 adding file changes
327 added 3 changesets with 3 changes to 1 files
328 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 $ cd repo2
319 $ cd repo2
330 $ hg outgoing -S
320 $ hg outgoing -S
@@ -44,7 +44,7 b' Clone main from hgweb'
44 adding file changes
44 adding file changes
45 added 1 changesets with 3 changes to 3 files
45 added 1 changesets with 3 changes to 3 files
46 updating to branch default
46 updating to branch default
47 pulling subrepo sub from http://localhost:$HGPORT/sub
47 cloning subrepo sub from http://localhost:$HGPORT/sub
48 requesting all changes
48 requesting all changes
49 adding changesets
49 adding changesets
50 adding manifests
50 adding manifests
@@ -79,7 +79,7 b' subrepo paths with ssh urls'
79 adding file changes
79 adding file changes
80 added 1 changesets with 3 changes to 3 files
80 added 1 changesets with 3 changes to 3 files
81 updating to branch default
81 updating to branch default
82 pulling subrepo sub from ssh://user@dummy/sub
82 cloning subrepo sub from ssh://user@dummy/sub
83 requesting all changes
83 requesting all changes
84 adding changesets
84 adding changesets
85 adding manifests
85 adding manifests
@@ -239,24 +239,9 b' clone'
239 $ cd ..
239 $ cd ..
240 $ hg clone t tc
240 $ hg clone t tc
241 updating to branch default
241 updating to branch default
242 pulling subrepo s from $TESTTMP/sub/t/s
242 cloning subrepo s from $TESTTMP/sub/t/s
243 requesting all changes
243 cloning subrepo s/ss from $TESTTMP/sub/t/s/ss
244 adding changesets
244 cloning subrepo t from $TESTTMP/sub/t/t
245 adding manifests
246 adding file changes
247 added 4 changesets with 5 changes to 3 files
248 pulling subrepo s/ss from $TESTTMP/sub/t/s/ss
249 requesting all changes
250 adding changesets
251 adding manifests
252 adding file changes
253 added 1 changesets with 1 changes to 1 files
254 pulling subrepo t from $TESTTMP/sub/t/t
255 requesting all changes
256 adding changesets
257 adding manifests
258 adding file changes
259 added 4 changesets with 4 changes to 1 files (+1 heads)
260 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ cd tc
246 $ cd tc
262 $ hg debugsub
247 $ hg debugsub
@@ -563,12 +548,7 b' Issue1977: multirepo push should fail if'
563 committing subrepository s
548 committing subrepository s
564 $ hg clone repo repo2
549 $ hg clone repo repo2
565 updating to branch default
550 updating to branch default
566 pulling subrepo s from $TESTTMP/sub/repo/s
551 cloning subrepo s from $TESTTMP/sub/repo/s
567 requesting all changes
568 adding changesets
569 adding manifests
570 adding file changes
571 added 1 changesets with 1 changes to 1 files
572 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
552 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
573 $ hg -q -R repo2 pull -u
553 $ hg -q -R repo2 pull -u
574 $ echo 1 > repo2/s/a
554 $ echo 1 > repo2/s/a
@@ -639,12 +619,7 b' Try the same, but with pull -u'
639 adding manifests
619 adding manifests
640 adding file changes
620 adding file changes
641 added 1 changesets with 2 changes to 2 files
621 added 1 changesets with 2 changes to 2 files
642 pulling subrepo sub/repo from issue1852a/sub/repo
622 cloning subrepo sub/repo from issue1852a/sub/repo
643 requesting all changes
644 adding changesets
645 adding manifests
646 adding file changes
647 added 2 changesets with 2 changes to 1 files
648 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
623 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
649
624
650 Try to push from the other side
625 Try to push from the other side
General Comments 0
You need to be logged in to leave comments. Login now