2014-08-06 20:43:59 +04:00
|
|
|
#require serve
|
2011-11-07 06:24:53 +04:00
|
|
|
|
2011-04-19 14:04:44 +04:00
|
|
|
$ hg init test
|
2010-09-14 14:20:51 +04:00
|
|
|
$ cd test
|
|
|
|
|
|
|
|
$ echo foo>foo
|
|
|
|
$ hg addremove
|
|
|
|
adding foo
|
|
|
|
$ hg commit -m 1
|
|
|
|
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
|
|
|
1 files, 1 changesets, 1 total revisions
|
|
|
|
|
|
|
|
$ hg serve -p $HGPORT -d --pid-file=hg.pid
|
|
|
|
$ cat hg.pid >> $DAEMON_PIDS
|
|
|
|
$ cd ..
|
|
|
|
|
2010-09-22 01:44:13 +04:00
|
|
|
$ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
|
2010-09-14 14:20:51 +04:00
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 340e38bdcde4
|
2010-09-14 14:20:51 +04:00
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ cd copy
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
|
|
|
1 files, 1 changesets, 1 total revisions
|
|
|
|
|
|
|
|
$ hg co
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cat foo
|
|
|
|
foo
|
|
|
|
|
|
|
|
$ hg manifest --debug
|
|
|
|
2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
|
|
|
|
|
2010-09-22 01:44:13 +04:00
|
|
|
$ hg pull
|
2011-11-22 22:06:42 +04:00
|
|
|
pulling from http://foo@localhost:$HGPORT/
|
2010-09-14 14:20:51 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
|
2010-09-22 01:44:13 +04:00
|
|
|
$ hg rollback --dry-run --verbose
|
2011-02-10 11:03:06 +03:00
|
|
|
repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
|
2010-09-14 14:20:51 +04:00
|
|
|
|
2015-10-09 02:19:37 +03:00
|
|
|
Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
|
|
|
|
not are encoded like a node:
|
|
|
|
|
|
|
|
$ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
|
|
|
|
pulling from http://foo@localhost:$HGPORT/
|
|
|
|
abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'!
|
|
|
|
[255]
|
|
|
|
$ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
|
|
|
|
pulling from http://foo@localhost:$HGPORT/
|
|
|
|
abort: unknown revision '7878787878787878787878787878787878782079'!
|
|
|
|
[255]
|
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue622: hg init && hg pull -u URL doesn't checkout default branch
|
2010-09-14 14:20:51 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ hg init empty
|
|
|
|
$ cd empty
|
|
|
|
$ hg pull -u ../test
|
|
|
|
pulling from ../test
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 340e38bdcde4
|
2010-09-14 14:20:51 +04:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
Test 'file:' uri handling:
|
|
|
|
|
2012-08-18 00:58:18 +04:00
|
|
|
$ hg pull -q file://../test-does-not-exist
|
2011-03-31 07:02:07 +04:00
|
|
|
abort: file:// URLs can only refer to localhost
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-09-14 14:20:51 +04:00
|
|
|
|
url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
This replaces util.drop_scheme() with url.localpath(), using url.url for
parsing instead of doing it on its own. The function is moved from
util to url to avoid an import cycle.
hg.localpath() is removed in favor of using url.localpath(). This
provides more consistent behavior between "hg clone" and other
commands.
To preserve backwards compatibility, URLs like bundle://../foo still
refer to ../foo, not /foo.
If a URL contains a scheme, percent-encoded entities are decoded. When
there's no scheme, all characters are left untouched.
Comparison of old and new behaviors:
URL drop_scheme() hg.localpath() url.localpath()
=== ============= ============== ===============
file://foo/foo /foo foo/foo /foo
file://localhost:80/foo /foo localhost:80/foo /foo
file://localhost:/foo /foo localhost:/foo /foo
file://localhost/foo /foo /foo /foo
file:///foo /foo /foo /foo
file://foo (empty string) foo /
file:/foo /foo /foo /foo
file:foo foo foo foo
file:foo%23bar foo%23bar foo%23bar foo#bar
foo%23bar foo%23bar foo%23bar foo%23bar
/foo /foo /foo /foo
Windows-related paths on Windows:
URL drop_scheme() hg.localpath() url.localpath()
=== ============= ============== ===============
file:///C:/foo C:/C:/foo /C:/foo C:/foo
file:///D:/foo C:/D:/foo /D:/foo D:/foo
file://C:/foo C:/foo C:/foo C:/foo
file://D:/foo C:/foo D:/foo D:/foo
file:////foo/bar //foo/bar //foo/bar //foo/bar
//foo/bar //foo/bar //foo/bar //foo/bar
\\foo\bar //foo/bar //foo/bar \\foo\bar
Windows-related paths on other platforms:
file:///C:/foo C:/C:/foo /C:/foo C:/foo
file:///D:/foo C:/D:/foo /D:/foo D:/foo
file://C:/foo C:/foo C:/foo C:/foo
file://D:/foo C:/foo D:/foo D:/foo
file:////foo/bar //foo/bar //foo/bar //foo/bar
//foo/bar //foo/bar //foo/bar //foo/bar
\\foo\bar //foo/bar //foo/bar \\foo\bar
For more information about file:// URL handling, see:
http://www-archive.mozilla.org/quality/networking/testing/filetests.html
Related issues:
- issue1153: File URIs aren't handled correctly in windows
This patch should preserve the fix implemented in
5c92d05b064e. However, it goes a step further and "promotes"
Windows-style drive letters from being interpreted as host names to
being part of the path.
- issue2154: Cannot escape '#' in Mercurial URLs (#1172 in THG)
The fragment is still interpreted as a revision or a branch, even in
paths to bundles. However, when file: is used, percent-encoded
entities are decoded, so file:test%23bundle.hg can refer to
test#bundle.hg ond isk.
2011-03-31 07:03:05 +04:00
|
|
|
$ hg pull -q file://../test
|
|
|
|
abort: file:// URLs can only refer to localhost
|
|
|
|
[255]
|
|
|
|
|
2017-04-02 08:51:07 +03:00
|
|
|
MSYS changes 'file:' into 'file;'
|
|
|
|
|
|
|
|
#if no-msys
|
2015-03-05 22:21:57 +03:00
|
|
|
$ hg pull -q file:../test # no-msys
|
2017-04-02 08:51:07 +03:00
|
|
|
#endif
|
2010-09-14 14:20:51 +04:00
|
|
|
|
2010-09-18 02:03:08 +04:00
|
|
|
It's tricky to make file:// URLs working on every platform with
|
|
|
|
regular shell commands.
|
2010-09-14 14:20:51 +04:00
|
|
|
|
2014-10-15 23:35:59 +04:00
|
|
|
$ URL=`$PYTHON -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
|
2010-09-14 14:20:51 +04:00
|
|
|
$ hg pull -q "$URL"
|
2011-03-31 07:01:31 +04:00
|
|
|
abort: file:// URLs can only refer to localhost
|
|
|
|
[255]
|
2010-09-14 14:20:51 +04:00
|
|
|
|
2014-10-15 23:35:59 +04:00
|
|
|
$ URL=`$PYTHON -c "import os; print 'file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
|
2011-03-31 07:01:31 +04:00
|
|
|
$ hg pull -q "$URL"
|
2012-06-11 03:40:51 +04:00
|
|
|
|
2017-07-29 02:47:32 +03:00
|
|
|
SEC: check for unsafe ssh url
|
|
|
|
|
2017-08-07 16:22:28 +03:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [ui]
|
|
|
|
> ssh = sh -c "read l; read l; read l"
|
|
|
|
> EOF
|
|
|
|
|
2017-07-29 02:47:32 +03:00
|
|
|
$ hg pull 'ssh://-oProxyCommand=touch${IFS}owned/path'
|
|
|
|
pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
|
|
|
|
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
|
|
|
|
[255]
|
|
|
|
$ hg pull 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
|
|
|
|
pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
|
|
|
|
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
|
|
|
|
[255]
|
2017-08-07 16:22:28 +03:00
|
|
|
$ hg pull 'ssh://fakehost|touch${IFS}owned/path'
|
|
|
|
pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
|
|
|
|
abort: no suitable response from remote hg!
|
2017-07-29 02:47:32 +03:00
|
|
|
[255]
|
2017-08-07 16:22:28 +03:00
|
|
|
$ hg pull 'ssh://fakehost%7Ctouch%20owned/path'
|
|
|
|
pulling from ssh://fakehost%7Ctouch%20owned/path
|
|
|
|
abort: no suitable response from remote hg!
|
2017-07-29 02:47:32 +03:00
|
|
|
[255]
|
|
|
|
|
2017-08-07 16:22:28 +03:00
|
|
|
$ [ ! -f owned ] || echo 'you got owned'
|
|
|
|
|
2012-06-11 03:40:51 +04:00
|
|
|
$ cd ..
|