Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
38e3f973a4f3
Commit
38e3f973a4f3
authored
14 years ago
by
Nicolas Dumazet
Browse files
Options
Downloads
Patches
Plain Diff
tests: unify test-init
parent
7d9be960cd9a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test-init.out
+0
-81
0 additions, 81 deletions
tests/test-init.out
tests/test-init.t
+137
-70
137 additions, 70 deletions
tests/test-init.t
with
137 additions
and
151 deletions
tests/test-init.out
deleted
100644 → 0
+
0
−
81
View file @
7d9be960
# creating 'local'
store created
00changelog.i created
revlogv1
store
fncache
adding foo
# creating repo with format.usestore=false
revlogv1
# creating repo with format.usefncache=false
store created
00changelog.i created
revlogv1
store
#test failure
abort: repository local already exists!
# init+push to remote2
comparing with local
changeset: 0:c4e059d443be
tag: tip
user: test
date: Mon Jan 12 13:46:40 1970 +0000
summary: init
pushing to ssh://user@dummy/remote2
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
# clone to remote1
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
# init to existing repo
abort: repository remote1 already exists!
abort: could not create remote repo!
# clone to existing repo
abort: repository remote1 already exists!
abort: could not create remote repo!
# output of dummyssh
Got arguments 1:user@dummy 2:hg init remote2
Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
Got arguments 1:user@dummy 2:hg init remote1
Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
Got arguments 1:user@dummy 2:hg init remote1
Got arguments 1:user@dummy 2:hg init remote1
# comparing repositories
0:c4e059d443be
0:c4e059d443be
0:c4e059d443be
# check names for repositories (clashes with URL schemes, special chars)
# hg init "bundle"
ok
# hg init "file"
ok
# hg init "hg"
ok
# hg init "http"
ok
# hg init "https"
ok
# hg init "old-http"
ok
# hg init "ssh"
ok
# hg init "static-http"
ok
# hg init " "
ok
# hg init "with space"
ok
# creating 'local/sub/repo'
store created
00changelog.i created
revlogv1
store
fncache
This diff is collapsed.
Click to expand it.
tests/test-init
→
tests/test-init
.t
100755 → 100644
+
137
−
70
View file @
38e3f973
#!/bin/sh
# This test tries to exercise the ssh functionality with a dummy script
...
...
@@ -3,10 +1,23 @@
# This test tries to exercise the ssh functionality with a dummy script
cat
<<
EOF
> dummyssh
import sys
import os
os.chdir(os.path.dirname(sys.argv[0]))
if sys.argv[1] != "user@dummy":
sys.exit(-1)
$
cat
<<
EOF
>
dummyssh
>
import
sys
>
import
os
>
>
os
.
chdir
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
>
if
sys
.
argv
[
1
]
!=
"
user
@dummy
":
>
sys
.
exit
(
-
1
)
>
>
if
not
os
.
path
.
exists
("
dummyssh
"):
>
sys
.
exit
(
-
1
)
>
>
log
=
open
("
dummylog
",
"
ab
")
>
log
.
write
("
Got arguments
")
>
for
i
,
arg
in
enumerate
(
sys
.
argv
[
1
:]):
>
log
.
write
("
%d:%s
"
%
(
i
+
1
,
arg
))
>
log
.
write
("
\n
")
>
log
.
close
()
>
r
=
os
.
system
(
sys
.
argv
[
2
])
>
sys
.
exit
(
bool
(
r
))
>
EOF
...
...
@@ -12,14 +23,13 @@
if not os.path.exists("dummyssh"):
sys.exit(-1)
log = open("dummylog", "ab")
log.write("Got arguments")
for i, arg in enumerate(sys.argv[1:]):
log.write(" %d:%s" % (i+1, arg))
log.write("
\n
")
log.close()
r = os.system(sys.argv[2])
sys.exit(bool(r))
EOF
$
checknewrepo
()
>
{
>
name
=
$
1
>
if
[
-
d
$name
/.hg/s
tore
];
then
>
echo
store
created
>
fi
>
if
[
-
f
$name
/.hg/
00
changelog
.
i
];
then
>
echo
00
changelog
.
i
created
>
fi
>
cat
$name
/.hg/
requires
>
}
...
...
@@ -25,5 +35,3 @@
checknewrepo
()
{
name
=
$1
creating
'
local
'
...
...
@@ -29,5 +37,14 @@
if
[
-d
$name
/.hg/store
]
;
then
echo
store created
fi
$
hg
init
local
$
checknewrepo
local
store
created
00
changelog
.
i
created
revlogv1
store
fncache
$
echo
this
>
local
/
foo
$
hg
ci
--
cwd
local
-
A
-
m "init"
-
d
"
1000000 0
"
adding
foo
creating
repo
with
format
.
usestore
=
false
...
...
@@ -33,5 +50,7 @@
if
[
-f
$name
/.hg/00changelog.i
]
;
then
echo
00changelog.i created
fi
$
hg
--
config
format
.
usestore
=
false
init
old
$
checknewrepo
old
revlogv1
creating
repo
with
format
.
usefncache
=
false
...
...
@@ -37,4 +56,8 @@
cat
$name
/.hg/requires
}
$
hg
--
config
format
.
usefncache
=
false
init
old2
$
checknewrepo
old2
store
created
00
changelog
.
i
created
revlogv1
store
...
...
@@ -40,7 +63,8 @@
echo
"# creating 'local'"
hg init
local
checknewrepo
local
echo
this
>
local
/foo
hg ci
--cwd
local
-A
-m
"init"
-d
"1000000 0"
test
failure
$
hg
init
local
abort:
repository
local
already
exists
!
init
+
push
to
remote2
...
...
@@ -46,5 +70,11 @@
echo
"# creating repo with format.usestore=false"
hg
--config
format.usestore
=
false
init old
checknewrepo old
$
hg
init
-
e
"
python ./dummyssh
"
ssh:
//us
er@dummy
/
remote2
$
hg
incoming
-
R
remote2
local
comparing
with
local
changeset:
0
:
c4e059d443be
tag:
tip
user:
test
date:
Mon
Jan
12
13
:
46
:
40
1970
+
0000
summary:
init
...
...
@@ -50,5 +80,9 @@
echo
"# creating repo with format.usefncache=false"
hg
--config
format.usefncache
=
false
init old2
checknewrepo old2
$
hg
push
-
R
local
-
e
"
python ./dummyssh
"
ssh:
//us
er@dummy
/
remote2
pushing
to
ssh:
//us
er@dummy
/
remote2
searching
for
changes
remote:
adding
changesets
remote:
adding
manifests
remote:
adding
file
changes
remote:
added
1
changesets
with
1
changes
to
1
files
...
...
@@ -54,4 +88,3 @@
echo
"#test failure"
hg init
local
clone
to
remote1
...
...
@@ -57,6 +90,10 @@
echo
"# init+push to remote2"
hg init
-e
"python ./dummyssh"
ssh://user@dummy/remote2
hg incoming
-R
remote2
local
hg push
-R
local
-e
"python ./dummyssh"
ssh://user@dummy/remote2
$
hg
clone
-
e
"
python ./dummyssh
"
local
ssh:
//us
er@dummy
/
remote1
searching
for
changes
remote:
adding
changesets
remote:
adding
manifests
remote:
adding
file
changes
remote:
added
1
changesets
with
1
changes
to
1
files
init
to
existing
repo
...
...
@@ -62,4 +99,7 @@
echo
"# clone to remote1"
hg clone
-e
"python ./dummyssh"
local
ssh://user@dummy/remote1
$
hg
init
-
e
"
python ./dummyssh
"
ssh:
//us
er@dummy
/
remote1
abort:
repository
remote1
already
exists
!
abort:
could
not
create
remote
repo
!
clone
to
existing
repo
...
...
@@ -65,4 +105,7 @@
echo
"# init to existing repo"
hg init
-e
"python ./dummyssh"
ssh://user@dummy/remote1
$
hg
clone
-
e
"
python ./dummyssh
"
local
ssh:
//us
er@dummy
/
remote1
abort:
repository
remote1
already
exists
!
abort:
could
not
create
remote
repo
!
output
of
dummyssh
...
...
@@ -68,4 +111,10 @@
echo
"# clone to existing repo"
hg clone
-e
"python ./dummyssh"
local
ssh://user@dummy/remote1
$
cat
dummylog
Got
arguments
1
:
user@dummy
2
:
hg
init
remote2
Got
arguments
1
:
user@dummy
2
:
hg
-
R
remote2
serve
--
stdio
Got
arguments
1
:
user@dummy
2
:
hg
-
R
remote2
serve
--
stdio
Got
arguments
1
:
user@dummy
2
:
hg
init
remote1
Got
arguments
1
:
user@dummy
2
:
hg
-
R
remote1
serve
--
stdio
Got
arguments
1
:
user@dummy
2
:
hg
init
remote1
Got
arguments
1
:
user@dummy
2
:
hg
init
remote1
...
...
@@ -71,4 +120,3 @@
echo
"# output of dummyssh"
cat
dummylog
comparing
repositories
...
...
@@ -74,6 +122,10 @@
echo
"# comparing repositories"
hg tip
-q
-R
local
hg tip
-q
-R
remote1
hg tip
-q
-R
remote2
$
hg
tip
-
q -R
local
0
:
c4e059d443be
$
hg
tip
-
q -R
remote1
0
:
c4e059d443be
$
hg
tip
-
q -R
remote2
0
:
c4e059d443be
check
names
for
repositories
(
clashes
with
URL
schemes
,
special
chars
)
...
...
@@ -79,8 +131,17 @@
echo
"# check names for repositories (clashes with URL schemes, special chars)"
for
i
in
bundle file hg http https old-http ssh static-http
" "
"with space"
;
do
echo
"# hg init
\"
$i
\"
"
hg init
"
$i
"
test
-d
"
$i
"
-a
-d
"
$i
/.hg"
&&
echo
"ok"
||
echo
"failed"
done
$
for
i
in
bundle
file
hg
http
https
old
-
http
ssh
static
-
http
"
"
"
with space
";
do
>
echo
-
n
"
hg init
\"
$i
\"
...
"
>
hg
init
"
$i
"
>
test
-
d
"
$i
"
-
a
-
d
"
$i
/.hg
"
&&
echo
"
ok
"
||
echo
"
failed
"
>
done
hg
init
"
bundle
"
...
ok
hg
init
"
file
"
...
ok
hg
init
"
hg
"
...
ok
hg
init
"
http
"
...
ok
hg
init
"
https
"
...
ok
hg
init
"
old-http
"
...
ok
hg
init
"
ssh
"
...
ok
hg
init
"
static-http
"
...
ok
hg
init
"
"
...
ok
hg
init
"
with space
"
...
ok
...
...
@@ -86,4 +147,10 @@
echo
"# creating 'local/sub/repo'"
hg init
local
/sub/repo
checknewrepo
local
/sub/repo
creating
'
local/sub/repo
'
$
hg
init
local
/sub/
repo
$
checknewrepo
local
/sub/
repo
store
created
00
changelog
.
i
created
revlogv1
store
fncache
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment