Show More
@@ -1079,7 +1079,8 b' class basefilectx(object):' | |||||
1079 | hist[f] = curr |
|
1079 | hist[f] = curr | |
1080 | del pcache[f] |
|
1080 | del pcache[f] | |
1081 |
|
1081 | |||
1082 | return pycompat.ziplist(hist[base][0], hist[base][1].splitlines(True)) |
|
1082 | lineattrs, text = hist[base] | |
|
1083 | return pycompat.ziplist(lineattrs, mdiff.splitnewlines(text)) | |||
1083 |
|
1084 | |||
1084 | def ancestors(self, followfirst=False): |
|
1085 | def ancestors(self, followfirst=False): | |
1085 | visit = {} |
|
1086 | visit = {} |
@@ -621,7 +621,13 b' class hgsubrepo(abstractsubrepo):' | |||||
621 | if len(self._repo) == 0: |
|
621 | if len(self._repo) == 0: | |
622 | # use self._repo.vfs instead of self.wvfs to remove .hg only |
|
622 | # use self._repo.vfs instead of self.wvfs to remove .hg only | |
623 | self._repo.vfs.rmtree() |
|
623 | self._repo.vfs.rmtree() | |
624 | if parentrepo.shared(): |
|
624 | ||
|
625 | # A remote subrepo could be shared if there is a local copy | |||
|
626 | # relative to the parent's share source. But clone pooling doesn't | |||
|
627 | # assemble the repos in a tree, so that can't be consistently done. | |||
|
628 | # A simpler option is for the user to configure clone pooling, and | |||
|
629 | # work with that. | |||
|
630 | if parentrepo.shared() and hg.islocal(srcurl): | |||
625 | self.ui.status(_('sharing subrepo %s from %s\n') |
|
631 | self.ui.status(_('sharing subrepo %s from %s\n') | |
626 | % (subrelpath(self), srcurl)) |
|
632 | % (subrelpath(self), srcurl)) | |
627 | shared = hg.share(self._repo._subparent.baseui, |
|
633 | shared = hg.share(self._repo._subparent.baseui, | |
@@ -629,11 +635,25 b' class hgsubrepo(abstractsubrepo):' | |||||
629 | update=False, bookmarks=False) |
|
635 | update=False, bookmarks=False) | |
630 | self._repo = shared.local() |
|
636 | self._repo = shared.local() | |
631 | else: |
|
637 | else: | |
|
638 | # TODO: find a common place for this and this code in the | |||
|
639 | # share.py wrap of the clone command. | |||
|
640 | if parentrepo.shared(): | |||
|
641 | pool = self.ui.config('share', 'pool') | |||
|
642 | if pool: | |||
|
643 | pool = util.expandpath(pool) | |||
|
644 | ||||
|
645 | shareopts = { | |||
|
646 | 'pool': pool, | |||
|
647 | 'mode': self.ui.config('share', 'poolnaming'), | |||
|
648 | } | |||
|
649 | else: | |||
|
650 | shareopts = {} | |||
|
651 | ||||
632 | self.ui.status(_('cloning subrepo %s from %s\n') |
|
652 | self.ui.status(_('cloning subrepo %s from %s\n') | |
633 | % (subrelpath(self), srcurl)) |
|
653 | % (subrelpath(self), srcurl)) | |
634 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
|
654 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, | |
635 | other, self._repo.root, |
|
655 | other, self._repo.root, | |
636 | update=False) |
|
656 | update=False, shareopts=shareopts) | |
637 | self._repo = cloned.local() |
|
657 | self._repo = cloned.local() | |
638 | self._initrepo(parentrepo, source, create=True) |
|
658 | self._initrepo(parentrepo, source, create=True) | |
639 | self._cachestorehash(srcurl) |
|
659 | self._cachestorehash(srcurl) |
@@ -897,6 +897,38 b' Annotate with --ignore-blank-lines (simi' | |||||
897 |
|
897 | |||
898 | $ cd .. |
|
898 | $ cd .. | |
899 |
|
899 | |||
|
900 | Annotate with orphaned CR (issue5798) | |||
|
901 | ------------------------------------- | |||
|
902 | ||||
|
903 | $ hg init repo-cr | |||
|
904 | $ cd repo-cr | |||
|
905 | ||||
|
906 | $ substcr() { | |||
|
907 | > sed 's/\r/[CR]/g' | |||
|
908 | > } | |||
|
909 | ||||
|
910 | >>> with open('a', 'wb') as f: | |||
|
911 | ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') | |||
|
912 | $ hg ci -qAm0 | |||
|
913 | >>> with open('a', 'wb') as f: | |||
|
914 | ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') | |||
|
915 | $ hg ci -m1 | |||
|
916 | ||||
|
917 | $ hg annotate -r0 a | substcr | |||
|
918 | 0: 0a[CR]0b[CR] | |||
|
919 | 0: 0c[CR]0d[CR] | |||
|
920 | 0: 0e | |||
|
921 | 0: 0f | |||
|
922 | 0: 0g | |||
|
923 | $ hg annotate -r1 a | substcr | |||
|
924 | 0: 0a[CR]0b[CR] | |||
|
925 | 1: 1c[CR]1d[CR] | |||
|
926 | 0: 0e | |||
|
927 | 1: 1f | |||
|
928 | 0: 0g | |||
|
929 | ||||
|
930 | $ cd .. | |||
|
931 | ||||
900 | Annotate with linkrev pointing to another branch |
|
932 | Annotate with linkrev pointing to another branch | |
901 | ------------------------------------------------ |
|
933 | ------------------------------------------------ | |
902 |
|
934 |
@@ -292,6 +292,43 b' Status between revisions:' | |||||
292 | z2 |
|
292 | z2 | |
293 | z3 |
|
293 | z3 | |
294 |
|
294 | |||
|
295 | Clone pooling from a remote URL will share the top level repo and the subrepos, | |||
|
296 | even if they are referenced by remote URL. | |||
|
297 | ||||
|
298 | $ hg --config extensions.share= --config share.pool=$TESTTMP/pool \ | |||
|
299 | > clone http://localhost:$HGPORT shared | |||
|
300 | (sharing from new pooled repository 23376cbba0d87c15906bb3652584927c140907bf) | |||
|
301 | requesting all changes | |||
|
302 | adding changesets | |||
|
303 | adding manifests | |||
|
304 | adding file changes | |||
|
305 | added 3 changesets with 5 changes to 3 files | |||
|
306 | new changesets 23376cbba0d8:1326fa26d0c0 | |||
|
307 | searching for changes | |||
|
308 | no changes found | |||
|
309 | updating working directory | |||
|
310 | cloning subrepo foo from http://localhost:$HGPORT/foo | |||
|
311 | (sharing from new pooled repository af048e97ade2e236f754f05d07013e586af0f8bf) | |||
|
312 | requesting all changes | |||
|
313 | adding changesets | |||
|
314 | adding manifests | |||
|
315 | adding file changes | |||
|
316 | added 4 changesets with 7 changes to 3 files | |||
|
317 | new changesets af048e97ade2:65903cebad86 | |||
|
318 | searching for changes | |||
|
319 | no changes found | |||
|
320 | cloning subrepo foo/bar from http://localhost:$HGPORT/foo/bar | |||
|
321 | (sharing from new pooled repository 4904098473f96c900fec436dad267edd4da59fad) | |||
|
322 | requesting all changes | |||
|
323 | adding changesets | |||
|
324 | adding manifests | |||
|
325 | adding file changes | |||
|
326 | added 3 changesets with 3 changes to 1 files | |||
|
327 | new changesets 4904098473f9:31ecbdafd357 | |||
|
328 | searching for changes | |||
|
329 | no changes found | |||
|
330 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
331 | ||||
295 | $ cat access.log |
|
332 | $ cat access.log | |
296 | * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) |
|
333 | * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |
297 | * "GET /?cmd=batch HTTP/1.1" 200 - * (glob) |
|
334 | * "GET /?cmd=batch HTTP/1.1" 200 - * (glob) | |
@@ -302,6 +339,27 b' Status between revisions:' | |||||
302 | * "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob) |
|
339 | * "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob) | |
303 | * "GET /foo/bar?cmd=batch HTTP/1.1" 200 - * (glob) |
|
340 | * "GET /foo/bar?cmd=batch HTTP/1.1" 200 - * (glob) | |
304 | * "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - * (glob) |
|
341 | * "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - * (glob) | |
|
342 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
343 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
344 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
345 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
346 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
347 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D1326fa26d0c00d2146c63b56bb6a45149d7325ac x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
348 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=1326fa26d0c00d2146c63b56bb6a45149d7325ac&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
349 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
350 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
351 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
352 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
353 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
354 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D65903cebad86f1a84bd4f1134f62fa7dcb7a1c98 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
355 | $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&heads=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
356 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
357 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
358 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
359 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
360 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=31ecbdafd357f54b281c9bd1d681bb90de219e22&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
361 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D31ecbdafd357f54b281c9bd1d681bb90de219e22 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
|
362 | $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=31ecbdafd357f54b281c9bd1d681bb90de219e22&heads=31ecbdafd357f54b281c9bd1d681bb90de219e22&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) | |||
305 |
|
363 | |||
306 | $ killdaemons.py |
|
364 | $ killdaemons.py | |
307 | $ rm hg1.pid error.log access.log |
|
365 | $ rm hg1.pid error.log access.log | |
@@ -485,6 +543,22 b' The newly cloned subrepos contain no wor' | |||||
485 | commit: (clean) |
|
543 | commit: (clean) | |
486 | update: 4 new changesets (update) |
|
544 | update: 4 new changesets (update) | |
487 |
|
545 | |||
|
546 | Sharing a local repo without the locally referenced subrepo (i.e. it was never | |||
|
547 | updated from null), fails the same as a clone operation. | |||
|
548 | ||||
|
549 | $ hg --config progress.disable=True clone -U ../empty ../empty2 | |||
|
550 | ||||
|
551 | $ hg --config extensions.share= --config progress.disable=True \ | |||
|
552 | > share ../empty2 ../empty_share | |||
|
553 | updating working directory | |||
|
554 | abort: repository $TESTTMP/empty2/foo not found! | |||
|
555 | [255] | |||
|
556 | ||||
|
557 | $ hg --config progress.disable=True clone ../empty2 ../empty_clone | |||
|
558 | updating to branch default | |||
|
559 | abort: repository $TESTTMP/empty2/foo not found! | |||
|
560 | [255] | |||
|
561 | ||||
488 | Disable progress extension and cleanup: |
|
562 | Disable progress extension and cleanup: | |
489 |
|
563 | |||
490 | $ mv $HGRCPATH.no-progress $HGRCPATH |
|
564 | $ mv $HGRCPATH.no-progress $HGRCPATH |
@@ -72,6 +72,87 b" subrepo debug for 'main' clone" | |||||
72 | source ../sub |
|
72 | source ../sub | |
73 | revision 863c1745b441bd97a8c4a096e87793073f4fb215 |
|
73 | revision 863c1745b441bd97a8c4a096e87793073f4fb215 | |
74 |
|
74 | |||
|
75 | Test sharing with a remote URL reference | |||
|
76 | ||||
|
77 | $ hg init absolute_subrepo | |||
|
78 | $ cd absolute_subrepo | |||
|
79 | $ echo foo > foo.txt | |||
|
80 | $ hg ci -Am 'initial commit' | |||
|
81 | adding foo.txt | |||
|
82 | $ echo "sub = http://localhost:$HGPORT/sub" > .hgsub | |||
|
83 | $ hg ci -Am 'add absolute subrepo' | |||
|
84 | adding .hgsub | |||
|
85 | $ cd .. | |||
|
86 | ||||
|
87 | Clone pooling works for local clones with a remote subrepo reference. The | |||
|
88 | subrepo is cloned to the pool and shared from there, so that all clones will | |||
|
89 | share the same subrepo. | |||
|
90 | ||||
|
91 | $ hg --config extensions.share= --config share.pool=$TESTTMP/pool \ | |||
|
92 | > clone absolute_subrepo cloned_from_abs | |||
|
93 | (sharing from new pooled repository 8d6a2f1e993b34b6557de0042cfe825ae12a8dae) | |||
|
94 | requesting all changes | |||
|
95 | adding changesets | |||
|
96 | adding manifests | |||
|
97 | adding file changes | |||
|
98 | added 2 changesets with 3 changes to 3 files | |||
|
99 | new changesets 8d6a2f1e993b:* (glob) | |||
|
100 | searching for changes | |||
|
101 | no changes found | |||
|
102 | updating working directory | |||
|
103 | cloning subrepo sub from http://localhost:$HGPORT/sub | |||
|
104 | (sharing from new pooled repository 863c1745b441bd97a8c4a096e87793073f4fb215) | |||
|
105 | requesting all changes | |||
|
106 | adding changesets | |||
|
107 | adding manifests | |||
|
108 | adding file changes | |||
|
109 | added 1 changesets with 1 changes to 1 files | |||
|
110 | new changesets 863c1745b441 | |||
|
111 | searching for changes | |||
|
112 | no changes found | |||
|
113 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
114 | ||||
|
115 | Vanilla sharing with a subrepo remote path reference will clone the subrepo. | |||
|
116 | Each share of these top level repos will end up with independent subrepo copies | |||
|
117 | (potentially leaving the shared parent with dangling cset references). | |||
|
118 | ||||
|
119 | $ hg --config extensions.share= share absolute_subrepo shared_from_abs | |||
|
120 | updating working directory | |||
|
121 | cloning subrepo sub from http://localhost:$HGPORT/sub | |||
|
122 | requesting all changes | |||
|
123 | adding changesets | |||
|
124 | adding manifests | |||
|
125 | adding file changes | |||
|
126 | added 1 changesets with 1 changes to 1 files | |||
|
127 | new changesets 863c1745b441 | |||
|
128 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
129 | ||||
|
130 | $ hg --config extensions.share= share -U absolute_subrepo shared_from_abs2 | |||
|
131 | $ hg -R shared_from_abs2 update -r tip | |||
|
132 | cloning subrepo sub from http://localhost:$HGPORT/sub | |||
|
133 | requesting all changes | |||
|
134 | adding changesets | |||
|
135 | adding manifests | |||
|
136 | adding file changes | |||
|
137 | added 1 changesets with 1 changes to 1 files | |||
|
138 | new changesets 863c1745b441 | |||
|
139 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
140 | ||||
|
141 | A parent repo without its subrepo available locally can be shared if the | |||
|
142 | subrepo is referenced by absolute path. | |||
|
143 | ||||
|
144 | $ hg clone -U absolute_subrepo cloned_null_from_abs | |||
|
145 | $ hg --config extensions.share= share cloned_null_from_abs shared_from_null_abs | |||
|
146 | updating working directory | |||
|
147 | cloning subrepo sub from http://localhost:$HGPORT/sub | |||
|
148 | requesting all changes | |||
|
149 | adding changesets | |||
|
150 | adding manifests | |||
|
151 | adding file changes | |||
|
152 | added 1 changesets with 1 changes to 1 files | |||
|
153 | new changesets 863c1745b441 | |||
|
154 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
155 | ||||
75 | $ killdaemons.py |
|
156 | $ killdaemons.py | |
76 |
|
157 | |||
77 | subrepo paths with ssh urls |
|
158 | subrepo paths with ssh urls |
General Comments 0
You need to be logged in to leave comments.
Login now