2012-10-31 04:03:26 +04:00
|
|
|
Load commonly used test logic
|
2018-01-09 17:08:01 +03:00
|
|
|
$ . "$TESTDIR/hggit/testutil"
|
2012-10-31 04:03:26 +04:00
|
|
|
|
2021-03-23 12:22:56 +03:00
|
|
|
$ git init -q gitrepo
|
2012-10-31 08:01:03 +04:00
|
|
|
$ cd gitrepo
|
2012-09-10 08:27:45 +04:00
|
|
|
$ echo alpha > alpha
|
|
|
|
$ git add alpha
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_git_commit -m "add alpha"
|
2018-01-09 16:53:20 +03:00
|
|
|
$ git checkout -b not-master
|
|
|
|
Switched to a new branch 'not-master'
|
2012-09-10 08:27:45 +04:00
|
|
|
|
|
|
|
$ cd ..
|
2012-09-14 04:49:45 +04:00
|
|
|
$ hg clone gitrepo hgrepo | grep -v '^updating'
|
2012-09-10 08:27:45 +04:00
|
|
|
importing git objects into hg
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ cd hgrepo
|
2016-01-09 01:02:20 +03:00
|
|
|
$ hg bookmark -q master
|
2012-09-10 08:27:45 +04:00
|
|
|
$ echo beta > beta
|
|
|
|
$ hg add beta
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_hg_commit -m 'add beta'
|
2012-09-10 08:27:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
$ echo gamma > gamma
|
|
|
|
$ hg add gamma
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_hg_commit -m 'add gamma'
|
2012-09-10 08:27:45 +04:00
|
|
|
|
2020-10-08 21:06:31 +03:00
|
|
|
$ hg book -r 574e2d660a7d7bbaf97251f694c8c8327f0db957 beta
|
2012-09-10 08:27:45 +04:00
|
|
|
$ hg push -r beta
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2013-01-06 10:46:57 +04:00
|
|
|
adding objects
|
2013-12-13 21:41:41 +04:00
|
|
|
added 1 commits with 1 trees and 1 blobs
|
2013-01-06 11:31:37 +04:00
|
|
|
adding reference refs/heads/beta
|
2012-09-10 08:27:45 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
should have two different branches
|
2012-09-10 08:27:45 +04:00
|
|
|
$ cd gitrepo
|
|
|
|
$ git branch -v
|
2014-12-03 01:17:09 +03:00
|
|
|
beta 0f378ab add beta
|
2012-09-10 08:27:45 +04:00
|
|
|
master 7eeab2e add alpha
|
|
|
|
* not-master 7eeab2e add alpha
|
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
some more work on master from git
|
2018-01-09 16:53:20 +03:00
|
|
|
$ git checkout master
|
|
|
|
Switched to branch 'master'
|
2012-09-10 08:27:45 +04:00
|
|
|
$ echo delta > delta
|
|
|
|
$ git add delta
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_git_commit -m "add delta"
|
2018-01-09 16:53:20 +03:00
|
|
|
$ git checkout not-master
|
|
|
|
Switched to branch 'not-master'
|
2012-09-10 08:27:45 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ cd hgrepo
|
2012-11-04 03:14:17 +04:00
|
|
|
this should fail
|
2012-09-10 08:27:45 +04:00
|
|
|
$ hg push -r master
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2013-12-16 00:25:31 +04:00
|
|
|
abort: branch 'refs/heads/master' changed on the server, please pull and merge before pushing
|
2012-09-10 08:27:45 +04:00
|
|
|
[255]
|
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
... even with -f
|
2012-09-10 08:27:45 +04:00
|
|
|
$ hg push -fr master
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2013-12-16 00:25:31 +04:00
|
|
|
abort: branch 'refs/heads/master' changed on the server, please pull and merge before pushing
|
2012-09-10 08:27:45 +04:00
|
|
|
[255]
|
|
|
|
|
2012-10-26 04:49:08 +04:00
|
|
|
$ hg pull 2>&1 | grep -v 'divergent bookmark'
|
2012-09-14 04:49:45 +04:00
|
|
|
pulling from $TESTTMP/gitrepo
|
2012-09-10 08:27:45 +04:00
|
|
|
importing git objects into hg
|
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
this should also fail
|
2012-09-10 08:27:45 +04:00
|
|
|
$ hg push -r master
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2018-12-06 23:00:57 +03:00
|
|
|
abort: pushing refs/heads/master overwrites 49480a0fbf45
|
2012-09-10 08:27:45 +04:00
|
|
|
[255]
|
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
... but succeed with -f
|
2012-09-10 08:27:45 +04:00
|
|
|
$ hg push -fr master
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2013-01-06 10:46:57 +04:00
|
|
|
adding objects
|
2013-12-13 21:41:41 +04:00
|
|
|
added 1 commits with 1 trees and 1 blobs
|
2013-01-06 11:31:37 +04:00
|
|
|
updating reference refs/heads/master
|
2012-09-10 08:27:45 +04:00
|
|
|
|
2012-11-04 03:14:17 +04:00
|
|
|
this should fail, no changes to push
|
2016-01-01 00:07:49 +03:00
|
|
|
$ hg push -r master
|
2012-09-14 04:49:45 +04:00
|
|
|
pushing to $TESTTMP/gitrepo
|
2012-10-08 04:11:27 +04:00
|
|
|
searching for changes
|
2012-09-10 08:27:45 +04:00
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
2014-03-25 22:11:04 +04:00
|
|
|
hg-git issue103 -- directories can lose information at hg-git export time
|
|
|
|
|
2014-05-27 05:37:09 +04:00
|
|
|
$ hg up master | egrep -v '^\(activating bookmark master\)$'
|
2014-03-25 22:11:04 +04:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ mkdir dir1
|
|
|
|
$ echo alpha > dir1/alpha
|
|
|
|
$ hg add dir1/alpha
|
|
|
|
$ fn_hg_commit -m 'add dir1/alpha'
|
|
|
|
$ hg push -r master
|
|
|
|
pushing to $TESTTMP/gitrepo
|
|
|
|
searching for changes
|
|
|
|
adding objects
|
|
|
|
added 1 commits with 2 trees and 0 blobs
|
|
|
|
updating reference refs/heads/master
|
|
|
|
|
|
|
|
$ echo beta > dir1/beta
|
|
|
|
$ hg add dir1/beta
|
|
|
|
$ fn_hg_commit -m 'add dir1/beta'
|
|
|
|
$ hg push -r master
|
|
|
|
pushing to $TESTTMP/gitrepo
|
|
|
|
searching for changes
|
|
|
|
adding objects
|
|
|
|
added 1 commits with 2 trees and 0 blobs
|
|
|
|
updating reference refs/heads/master
|
|
|
|
$ hg log -r master
|
2020-07-21 03:23:52 +03:00
|
|
|
commit: e4281e9db8f8
|
2014-03-25 22:11:04 +04:00
|
|
|
bookmark: master
|
|
|
|
user: test
|
|
|
|
date: Mon Jan 01 00:00:15 2007 +0000
|
|
|
|
summary: add dir1/beta
|
|
|
|
|
|
|
|
|
2012-09-10 08:27:45 +04:00
|
|
|
$ cd ..
|
2012-10-25 08:40:35 +04:00
|
|
|
|
2014-03-25 22:11:04 +04:00
|
|
|
$ hg clone gitrepo hgrepo-test
|
|
|
|
importing git objects into hg
|
|
|
|
updating to branch default
|
|
|
|
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg -R hgrepo-test log -r master
|
2020-07-21 03:23:52 +03:00
|
|
|
commit: 8df619e46009
|
2014-03-25 22:11:04 +04:00
|
|
|
bookmark: master
|
|
|
|
user: test
|
|
|
|
date: Mon Jan 01 00:00:15 2007 +0000
|
|
|
|
summary: add dir1/beta
|
|
|
|
|
|
|
|
|
2012-10-25 08:40:35 +04:00
|
|
|
Push empty Hg repo to empty Git repo (issue #58)
|
|
|
|
$ hg init hgrepo2
|
|
|
|
$ git init -q --bare gitrepo2
|
2016-01-01 00:07:49 +03:00
|
|
|
$ hg -R hgrepo2 push gitrepo2
|
2012-10-25 08:40:35 +04:00
|
|
|
pushing to gitrepo2
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
2015-02-21 09:49:43 +03:00
|
|
|
|
|
|
|
The remote repo is empty and the local one doesn't have any bookmarks/tags
|
|
|
|
$ cd hgrepo2
|
|
|
|
$ echo init >> test.txt
|
|
|
|
$ hg addremove
|
|
|
|
adding test.txt
|
|
|
|
$ fn_hg_commit -m init
|
|
|
|
$ hg update null
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg push ../gitrepo2
|
|
|
|
pushing to ../gitrepo2
|
|
|
|
searching for changes
|
|
|
|
adding objects
|
|
|
|
added 1 commits with 1 trees and 1 blobs
|
2015-05-28 22:44:00 +03:00
|
|
|
(the phases line was added in Mercurial 3.5)
|
|
|
|
$ hg summary | grep -Ev '^phases:'
|
2020-10-09 23:50:58 +03:00
|
|
|
parent: 000000000000 (no revision checked out)
|
2015-02-21 09:49:43 +03:00
|
|
|
commit: (clean)
|
|
|
|
Only one bookmark 'master' should be created
|
|
|
|
$ hg bookmarks
|
2020-10-09 08:27:14 +03:00
|
|
|
* master 8aded40be5af
|
2017-08-10 04:34:15 +03:00
|
|
|
|
|
|
|
test for ssh vulnerability
|
|
|
|
|
2017-08-10 21:19:04 +03:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [ui]
|
|
|
|
> ssh = ssh -o ConnectTimeout=1
|
|
|
|
> EOF
|
|
|
|
$ hg push 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
|
2020-12-17 07:08:44 +03:00
|
|
|
pushing to git+ssh://-oProxyCommand%3Drm%24%7BIFS%7Dnonexistent/path
|
2017-08-10 04:34:15 +03:00
|
|
|
abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
|
2017-08-10 21:19:04 +03:00
|
|
|
[255]
|
|
|
|
$ hg push 'git+ssh://-oProxyCommand=rm%20nonexistent/path' 2>&1 >/dev/null
|
2020-12-17 07:08:44 +03:00
|
|
|
pushing to git+ssh://-oProxyCommand%3Drm%20nonexistent/path
|
2017-08-10 04:34:15 +03:00
|
|
|
abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
|
2017-08-10 21:19:04 +03:00
|
|
|
[255]
|
2018-01-09 16:53:20 +03:00
|
|
|
$ hg push 'git+ssh://fakehost|rm%20nonexistent/path' 2>&1 >/dev/null
|
2020-12-17 07:08:44 +03:00
|
|
|
pushing to git+ssh://fakehost%7Crm%20nonexistent/path
|
2019-02-14 06:50:13 +03:00
|
|
|
ssh: .* fakehost%7[Cc]rm%20nonexistent.* (re)
|
2017-08-10 21:19:04 +03:00
|
|
|
abort: git remote error: The remote server unexpectedly closed the connection.
|
2018-01-09 16:53:20 +03:00
|
|
|
[255]
|
|
|
|
$ hg push 'git+ssh://fakehost%7Crm%20nonexistent/path' 2>&1 >/dev/null
|
2020-12-17 07:08:44 +03:00
|
|
|
pushing to git+ssh://fakehost%7Crm%20nonexistent/path
|
2019-02-14 06:50:13 +03:00
|
|
|
ssh: .* fakehost%7[Cc]rm%20nonexistent.* (re)
|
2017-08-10 21:19:04 +03:00
|
|
|
abort: git remote error: The remote server unexpectedly closed the connection.
|
2018-01-09 16:53:20 +03:00
|
|
|
[255]
|