Show More
@@ -2524,6 +2524,7 b' def _dograft(ui, repo, *revs, **opts):' | |||
|
2524 | 2524 | revs.remove(ids[n]) |
|
2525 | 2525 | elif ctx.hex() in ids: |
|
2526 | 2526 | r = ids[ctx.hex()] |
|
2527 | if r in revs: | |
|
2527 | 2528 | ui.warn(_('skipping already grafted revision %d:%s ' |
|
2528 | 2529 | '(was grafted from %d:%s)\n') % |
|
2529 | 2530 | (r, repo[r], rev, ctx)) |
@@ -181,7 +181,22 b' def checkexec(path):' | |||
|
181 | 181 | |
|
182 | 182 | try: |
|
183 | 183 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
|
184 |
|
|
|
184 | basedir = os.path.join(path, '.hg') | |
|
185 | cachedir = os.path.join(basedir, 'cache') | |
|
186 | storedir = os.path.join(basedir, 'store') | |
|
187 | if not os.path.exists(cachedir): | |
|
188 | try: | |
|
189 | # we want to create the 'cache' directory, not the '.hg' one. | |
|
190 | # Automatically creating '.hg' directory could silently spawn | |
|
191 | # invalid Mercurial repositories. That seems like a bad idea. | |
|
192 | os.mkdir(cachedir) | |
|
193 | if os.path.exists(storedir): | |
|
194 | copymode(storedir, cachedir) | |
|
195 | else: | |
|
196 | copymode(basedir, cachedir) | |
|
197 | except (IOError, OSError): | |
|
198 | # we other fallback logic triggers | |
|
199 | pass | |
|
185 | 200 | if os.path.isdir(cachedir): |
|
186 | 201 | checkisexec = os.path.join(cachedir, 'checkisexec') |
|
187 | 202 | checknoexec = os.path.join(cachedir, 'checknoexec') |
@@ -622,7 +622,11 b' class hgsubrepo(abstractsubrepo):' | |||
|
622 | 622 | return True |
|
623 | 623 | self._repo._subsource = source |
|
624 | 624 | srcurl = _abssource(self._repo) |
|
625 | other = hg.peer(self._repo, {}, srcurl) | |
|
625 | ||
|
626 | # Defer creating the peer until after the status message is logged, in | |
|
627 | # case there are network problems. | |
|
628 | getpeer = lambda: hg.peer(self._repo, {}, srcurl) | |
|
629 | ||
|
626 | 630 | if len(self._repo) == 0: |
|
627 | 631 | # use self._repo.vfs instead of self.wvfs to remove .hg only |
|
628 | 632 | self._repo.vfs.rmtree() |
@@ -636,7 +640,7 b' class hgsubrepo(abstractsubrepo):' | |||
|
636 | 640 | self.ui.status(_('sharing subrepo %s from %s\n') |
|
637 | 641 | % (subrelpath(self), srcurl)) |
|
638 | 642 | shared = hg.share(self._repo._subparent.baseui, |
|
639 |
|
|
|
643 | getpeer(), self._repo.root, | |
|
640 | 644 | update=False, bookmarks=False) |
|
641 | 645 | self._repo = shared.local() |
|
642 | 646 | else: |
@@ -657,7 +661,7 b' class hgsubrepo(abstractsubrepo):' | |||
|
657 | 661 | self.ui.status(_('cloning subrepo %s from %s\n') |
|
658 | 662 | % (subrelpath(self), util.hidepassword(srcurl))) |
|
659 | 663 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
|
660 |
|
|
|
664 | getpeer(), self._repo.root, | |
|
661 | 665 | update=False, shareopts=shareopts) |
|
662 | 666 | self._repo = cloned.local() |
|
663 | 667 | self._initrepo(parentrepo, source, create=True) |
@@ -666,7 +670,7 b' class hgsubrepo(abstractsubrepo):' | |||
|
666 | 670 | self.ui.status(_('pulling subrepo %s from %s\n') |
|
667 | 671 | % (subrelpath(self), util.hidepassword(srcurl))) |
|
668 | 672 | cleansub = self.storeclean(srcurl) |
|
669 |
exchange.pull(self._repo, |
|
|
673 | exchange.pull(self._repo, getpeer()) | |
|
670 | 674 | if cleansub: |
|
671 | 675 | # keep the repo clean after pull |
|
672 | 676 | self._cachestorehash(srcurl) |
@@ -88,6 +88,9 b' Non store repo:' | |||
|
88 | 88 | .hg/00manifest.i |
|
89 | 89 | .hg/cache |
|
90 | 90 | .hg/cache/branch2-served |
|
91 | .hg/cache/checkisexec (execbit !) | |
|
92 | .hg/cache/checklink (symlink !) | |
|
93 | .hg/cache/checklink-target (symlink !) | |
|
91 | 94 | .hg/cache/manifestfulltextcache (reporevlogstore !) |
|
92 | 95 | .hg/cache/rbc-names-v1 |
|
93 | 96 | .hg/cache/rbc-revs-v1 |
@@ -122,6 +125,9 b' Non fncache repo:' | |||
|
122 | 125 | .hg/00changelog.i |
|
123 | 126 | .hg/cache |
|
124 | 127 | .hg/cache/branch2-served |
|
128 | .hg/cache/checkisexec (execbit !) | |
|
129 | .hg/cache/checklink (symlink !) | |
|
130 | .hg/cache/checklink-target (symlink !) | |
|
125 | 131 | .hg/cache/manifestfulltextcache (reporevlogstore !) |
|
126 | 132 | .hg/cache/rbc-names-v1 |
|
127 | 133 | .hg/cache/rbc-revs-v1 |
@@ -1422,6 +1422,52 b' also detecting that both 3 and 5 should ' | |||
|
1422 | 1422 | |
|
1423 | 1423 | $ cd .. |
|
1424 | 1424 | |
|
1425 | Grafted revision should be warned and skipped only once. (issue6024) | |
|
1426 | ||
|
1427 | $ mkdir issue6024 | |
|
1428 | $ cd issue6024 | |
|
1429 | ||
|
1430 | $ hg init base | |
|
1431 | $ cd base | |
|
1432 | $ touch x | |
|
1433 | $ hg commit -qAminit | |
|
1434 | $ echo a > x | |
|
1435 | $ hg commit -mchange | |
|
1436 | $ hg update -q 0 | |
|
1437 | $ hg graft -r 1 | |
|
1438 | grafting 1:a0b923c546aa "change" (tip) | |
|
1439 | $ cd .. | |
|
1440 | ||
|
1441 | $ hg clone -qr 2 base clone | |
|
1442 | $ cd clone | |
|
1443 | $ hg pull -q | |
|
1444 | $ hg merge -q 2 | |
|
1445 | $ hg commit -mmerge | |
|
1446 | $ hg update -q 0 | |
|
1447 | $ hg graft -r 1 | |
|
1448 | grafting 1:04fc6d444368 "change" | |
|
1449 | $ hg update -q 3 | |
|
1450 | $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' | |
|
1451 | o 4:4e16 <- a0b9 | |
|
1452 | | | |
|
1453 | | @ 3:f0ac <- | |
|
1454 | | |\ | |
|
1455 | +---o 2:a0b9 <- | |
|
1456 | | | | |
|
1457 | | o 1:04fc <- a0b9 | |
|
1458 | |/ | |
|
1459 | o 0:7848 <- | |
|
1460 | ||
|
1461 | ||
|
1462 | the source of rev 4 is an ancestor of the working parent, and was also | |
|
1463 | grafted as rev 1. it should be stripped from the target revisions only once. | |
|
1464 | ||
|
1465 | $ hg graft -r 4 | |
|
1466 | skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) | |
|
1467 | [255] | |
|
1468 | ||
|
1469 | $ cd ../.. | |
|
1470 | ||
|
1425 | 1471 | Testing the reading of old format graftstate file with newer mercurial |
|
1426 | 1472 | |
|
1427 | 1473 | $ hg init oldgraft |
@@ -340,6 +340,7 b' clone of serve with repo in root and uns' | |||
|
340 | 340 | added 3 changesets with 7 changes to 7 files |
|
341 | 341 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
342 | 342 | updating to branch default |
|
343 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
|
343 | 344 | abort: HTTP Error 404: Not Found |
|
344 | 345 | [255] |
|
345 | 346 | $ hg clone http://localhost:$HGPORT/ slash-clone |
@@ -350,6 +351,7 b' clone of serve with repo in root and uns' | |||
|
350 | 351 | added 3 changesets with 7 changes to 7 files |
|
351 | 352 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
352 | 353 | updating to branch default |
|
354 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
|
353 | 355 | abort: HTTP Error 404: Not Found |
|
354 | 356 | [255] |
|
355 | 357 |
@@ -417,6 +417,7 b' clone of serve with repo in root and uns' | |||
|
417 | 417 | added 3 changesets with 7 changes to 7 files |
|
418 | 418 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
419 | 419 | updating to branch default |
|
420 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
|
420 | 421 | abort: HTTP Error 404: Not Found |
|
421 | 422 | [255] |
|
422 | 423 | $ hg clone http://localhost:$HGPORT/ slash-clone |
@@ -427,6 +428,7 b' clone of serve with repo in root and uns' | |||
|
427 | 428 | added 3 changesets with 7 changes to 7 files |
|
428 | 429 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
429 | 430 | updating to branch default |
|
431 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
|
430 | 432 | abort: HTTP Error 404: Not Found |
|
431 | 433 | [255] |
|
432 | 434 |
@@ -69,6 +69,9 b' new directories are setgid' | |||
|
69 | 69 | 00600 ./.hg/00changelog.i |
|
70 | 70 | 00770 ./.hg/cache/ |
|
71 | 71 | 00660 ./.hg/cache/branch2-served |
|
72 | 00711 ./.hg/cache/checkisexec | |
|
73 | 00777 ./.hg/cache/checklink | |
|
74 | 00600 ./.hg/cache/checklink-target | |
|
72 | 75 | 00660 ./.hg/cache/manifestfulltextcache (reporevlogstore !) |
|
73 | 76 | 00660 ./.hg/cache/rbc-names-v1 |
|
74 | 77 | 00660 ./.hg/cache/rbc-revs-v1 |
@@ -22,16 +22,22 b" share shouldn't have a store dir" | |||
|
22 | 22 | $ test -d .hg/store |
|
23 | 23 | [1] |
|
24 | 24 | |
|
25 | share shouldn't have a cache dir, original repo should | |
|
25 | share shouldn't have a full cache dir, original repo should | |
|
26 | 26 | |
|
27 | 27 | $ hg branches |
|
28 | 28 | default 0:d3873e73d99e |
|
29 | 29 | $ hg tags |
|
30 | 30 | tip 0:d3873e73d99e |
|
31 |
$ |
|
|
32 | [1] | |
|
31 | $ ls -1 .hg/cache || true | |
|
32 | ls: .hg/cache: $ENOENT$ (no-execbit no-symlink !) | |
|
33 | checkisexec (execbit !) | |
|
34 | checklink (symlink !) | |
|
35 | checklink-target (symlink !) | |
|
33 | 36 |
$ |
|
34 | 37 | branch2-served |
|
38 | checkisexec (execbit !) | |
|
39 | checklink (symlink !) | |
|
40 | checklink-target (symlink !) | |
|
35 | 41 | manifestfulltextcache (reporevlogstore !) |
|
36 | 42 | rbc-names-v1 |
|
37 | 43 | rbc-revs-v1 |
@@ -108,6 +108,7 b" are also available as siblings of 'main'" | |||
|
108 | 108 | added 1 changesets with 3 changes to 3 files |
|
109 | 109 | new changesets 7f491f53a367 |
|
110 | 110 | updating to branch default |
|
111 | cloning subrepo sub1 from http://localhost:$HGPORT/../sub1 | |
|
111 | 112 | abort: HTTP Error 404: Not Found |
|
112 | 113 | [255] |
|
113 | 114 |
@@ -574,6 +574,7 b' whereas clone should fail.' | |||
|
574 | 574 | |
|
575 | 575 | $ hg --config progress.disable=True clone ../empty2 ../empty_clone |
|
576 | 576 | updating to branch default |
|
577 | cloning subrepo foo from $TESTTMP/empty2/foo | |
|
577 | 578 | abort: repository $TESTTMP/empty2/foo not found! |
|
578 | 579 | [255] |
|
579 | 580 |
@@ -1889,6 +1889,7 b' test for ssh exploit 2017-07-25' | |||
|
1889 | 1889 | $ cd .. |
|
1890 | 1890 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1891 | 1891 | updating to branch default |
|
1892 | cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path | |
|
1892 | 1893 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1893 | 1894 | [255] |
|
1894 | 1895 | |
@@ -1901,6 +1902,7 b" also check that a percent encoded '-' (%" | |||
|
1901 | 1902 | $ rm -r malicious-proxycommand-clone |
|
1902 | 1903 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1903 | 1904 | updating to branch default |
|
1905 | cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path | |
|
1904 | 1906 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1905 | 1907 | [255] |
|
1906 | 1908 | |
@@ -1913,6 +1915,7 b' also check for a pipe' | |||
|
1913 | 1915 | $ rm -r malicious-proxycommand-clone |
|
1914 | 1916 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1915 | 1917 | updating to branch default |
|
1918 | cloning subrepo s from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path | |
|
1916 | 1919 | abort: no suitable response from remote hg! |
|
1917 | 1920 | [255] |
|
1918 | 1921 | $ [ ! -f owned ] || echo 'you got owned' |
@@ -1926,6 +1929,7 b" also check that a percent encoded '|' (%" | |||
|
1926 | 1929 | $ rm -r malicious-proxycommand-clone |
|
1927 | 1930 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1928 | 1931 | updating to branch default |
|
1932 | cloning subrepo s from ssh://fakehost%7Ctouch%20owned/path | |
|
1929 | 1933 | abort: no suitable response from remote hg! |
|
1930 | 1934 | [255] |
|
1931 | 1935 | $ [ ! -f owned ] || echo 'you got owned' |
@@ -1938,6 +1942,7 b' and bad usernames:' | |||
|
1938 | 1942 | $ rm -r malicious-proxycommand-clone |
|
1939 | 1943 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1940 | 1944 | updating to branch default |
|
1945 | cloning subrepo s from ssh://-oProxyCommand%3Dtouch%20owned@example.com/path | |
|
1941 | 1946 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s") |
|
1942 | 1947 | [255] |
|
1943 | 1948 |
General Comments 0
You need to be logged in to leave comments.
Login now