Mercurial > hg > hg-git
annotate tests/test-push.t @ 550:4bc39fd24db3
push: change "no changes" default output to match normal mercurial
The output for "hg push" when there were no changes didn't quite match between
Mercurial with and without Hg-Git, so I changed the behavior to bring it into
synch. The existing "creating and sending data" message was changed to be
included if --verbose is specified.
author | David M. Carr <david@carrclan.us> |
---|---|
date | Sun, 07 Oct 2012 20:11:27 -0400 |
parents | 7edcbdd2ef2f |
children | 06a29fdd52a7 |
rev | line source |
---|---|
512 | 1 # Fails for some reason, need to investigate |
2 # $ "$TESTDIR/hghave" git || exit 80 | |
3 | |
4 bail if the user does not have dulwich | |
5 $ python -c 'import dulwich, dulwich.repo' || exit 80 | |
6 | |
7 $ echo "[extensions]" >> $HGRCPATH | |
8 $ echo "hggit=$(echo $(dirname $TESTDIR))/hggit" >> $HGRCPATH | |
9 $ echo 'hgext.graphlog =' >> $HGRCPATH | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
10 |
512 | 11 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
12 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL | |
13 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE | |
14 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME | |
15 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL | |
16 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE | |
259
8b9fc1b1cc40
tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents:
244
diff
changeset
|
17 |
512 | 18 $ count=10 |
19 $ commit() | |
20 > { | |
21 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" | |
22 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | |
23 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | |
24 > count=`expr $count + 1` | |
25 > } | |
26 $ hgcommit() | |
27 > { | |
28 > HGDATE="2007-01-01 00:00:$count +0000" | |
29 > hg commit -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error" | |
30 > count=`expr $count + 1` | |
31 > } | |
32 | |
33 $ mkdir gitrepo | |
34 $ cd gitrepo | |
528
e48a3f30b73c
tests: remove piping of command git init to remove leading path
David M. Carr <david@carrclan.us>
parents:
527
diff
changeset
|
35 $ git init |
e48a3f30b73c
tests: remove piping of command git init to remove leading path
David M. Carr <david@carrclan.us>
parents:
527
diff
changeset
|
36 Initialized empty Git repository in $TESTTMP/gitrepo/.git/ |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
37 |
512 | 38 $ echo alpha > alpha |
39 $ git add alpha | |
40 $ commit -m "add alpha" | |
41 $ git checkout -b not-master 2>&1 | sed s/\'/\"/g | |
42 Switched to a new branch "not-master" | |
43 | |
44 $ cd .. | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
45 $ hg clone gitrepo hgrepo | grep -v '^updating' |
512 | 46 importing git objects into hg |
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
48 | |
49 $ cd hgrepo | |
50 $ echo beta > beta | |
51 $ hg add beta | |
52 $ hgcommit -m 'add beta' | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
53 |
294
29e342590c11
tests: many, many changes so we never push into a checked-out ref
Augie Fackler <durin42@gmail.com>
parents:
273
diff
changeset
|
54 |
512 | 55 $ echo gamma > gamma |
56 $ hg add gamma | |
57 $ hgcommit -m 'add gamma' | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
58 |
512 | 59 $ hg book -r 1 beta |
60 $ hg push -r beta | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
61 pushing to $TESTTMP/gitrepo |
512 | 62 exporting hg objects to git |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
63 searching for changes |
512 | 64 default::refs/heads/beta => GIT:cffa0e8d |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
65 |
512 | 66 $ cd .. |
67 | |
68 $ echo % should have two different branches | |
69 % should have two different branches | |
70 $ cd gitrepo | |
71 $ git branch -v | |
72 beta cffa0e8 add beta | |
73 master 7eeab2e add alpha | |
74 * not-master 7eeab2e add alpha | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
75 |
512 | 76 $ echo % some more work on master from git |
77 % some more work on master from git | |
78 $ git checkout master 2>&1 | sed s/\'/\"/g | |
79 Switched to branch "master" | |
80 $ echo delta > delta | |
81 $ git add delta | |
82 $ commit -m "add delta" | |
83 $ git checkout not-master 2>&1 | sed s/\'/\"/g | |
84 Switched to branch "not-master" | |
85 | |
86 $ cd .. | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
87 |
512 | 88 $ cd hgrepo |
89 $ echo % this should fail | |
90 % this should fail | |
91 $ hg push -r master | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
92 pushing to $TESTTMP/gitrepo |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
93 searching for changes |
512 | 94 abort: refs/heads/master changed on the server, please pull and merge before pushing |
95 [255] | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
96 |
512 | 97 $ echo % ... even with -f |
98 % ... even with -f | |
99 $ hg push -fr master | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
100 pushing to $TESTTMP/gitrepo |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
101 searching for changes |
512 | 102 abort: refs/heads/master changed on the server, please pull and merge before pushing |
103 [255] | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
104 |
512 | 105 $ hg pull |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
106 pulling from $TESTTMP/gitrepo |
512 | 107 importing git objects into hg |
108 (run 'hg update' to get a working copy) | |
109 TODO shouldn't need to do this since we're (in theory) pushing master explicitly, | |
110 which should not implicitly also push the not-master ref. | |
111 $ hg book not-master -r default/not-master --force | |
112 $ echo % master and default/master should be diferent | |
113 % master and default/master should be diferent | |
114 $ hg log -r master | grep -v ': *master' | |
115 changeset: 2:72f56395749d | |
116 user: test | |
117 date: Mon Jan 01 00:00:12 2007 +0000 | |
118 summary: add gamma | |
119 | |
120 $ hg log -r default/master | |
121 changeset: 3:1436150b86c2 | |
122 tag: default/master | |
123 tag: tip | |
124 parent: 0:3442585be8a6 | |
125 user: test <test@example.org> | |
126 date: Mon Jan 01 00:00:13 2007 +0000 | |
127 summary: add delta | |
128 | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
129 |
512 | 130 $ echo % this should also fail |
131 % this should also fail | |
132 $ hg push -r master | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
133 pushing to $TESTTMP/gitrepo |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
134 searching for changes |
512 | 135 abort: pushing refs/heads/master overwrites 72f56395749d |
136 [255] | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
137 |
512 | 138 $ echo % ... but succeed with -f |
139 % ... but succeed with -f | |
140 $ hg push -fr master | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
141 pushing to $TESTTMP/gitrepo |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
142 searching for changes |
512 | 143 default::refs/heads/master => GIT:cc119202 |
487
68e5dddc7a20
push: return 1 if no changes found, 0 if success
David M. Carr <david@carrclan.us>
parents:
390
diff
changeset
|
144 |
512 | 145 $ echo % this should fail, no changes to push |
146 % this should fail, no changes to push | |
147 The exit code for this was broken in Mercurial (incorrectly returning 0) until | |
148 issue3228 was fixed in 2.1 | |
149 $ hg push -r master && false | |
529
7edcbdd2ef2f
tests: eliminate use of git-daemon
David M. Carr <david@carrclan.us>
parents:
528
diff
changeset
|
150 pushing to $TESTTMP/gitrepo |
550
4bc39fd24db3
push: change "no changes" default output to match normal mercurial
David M. Carr <david@carrclan.us>
parents:
529
diff
changeset
|
151 searching for changes |
512 | 152 no changes found |
153 [1] | |
230
51e4d6ebbc40
rework pushing to support --rev and --force options
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff
changeset
|
154 |
512 | 155 $ cd .. |