##// END OF EJS Templates
pull: update to branch tip if there is only one head on the current branch...
Benoit Allard -
r7372:e17dbf14 default
parent child Browse files
Show More
@@ -0,0 +1,75 b''
1 #!/bin/sh
2
3 hg init t
4 cd t
5 echo 1 > foo
6 hg ci -Am1 # 0
7 hg branch branchA
8 echo a1 > foo
9 hg ci -ma1 # 1
10
11 cd ..
12 hg init tt
13 cd tt
14 hg pull ../t
15 hg up branchA
16
17 cd ../t
18 echo a2 > foo
19 hg ci -ma2 # 2
20 echo % create branch B
21 hg up 0
22 hg branch branchB
23 echo b1 > foo
24 hg ci -mb1 # 3
25
26 cd ../tt
27 echo % a new branch is there
28 hg pull -u ../t
29
30 echo % develop both branch
31 cd ../t
32 hg up branchA
33 echo a3 > foo
34 hg ci -ma3 # 4
35 hg up branchB
36 echo b2 > foo
37 hg ci -mb2 # 5
38
39 cd ../tt
40 echo % should succeed, no new heads
41 hg pull -u ../t
42
43 echo % add an head on other branch
44 cd ../t
45 hg up branchA
46 echo a4 > foo
47 hg ci -ma4 # 6
48 hg up branchB
49 echo b3.1 > foo
50 hg ci -m b3.1 # 7
51 hg up 5
52 echo b3.2 > foo
53 hg ci -m b3.2 # 8
54
55 cd ../tt
56 echo % should succeed only one head on our branch
57 hg pull -u ../t
58
59 cd ../t
60 hg up -C branchA
61 echo a5.1 > foo
62 hg ci -ma5.1 # 9
63 hg up 6
64 echo a5.2 > foo
65 hg ci -ma5.2 # 10
66 hg up 7
67 echo b4.1 > foo
68 hg ci -m b4.1 # 11
69 hg up -C 8
70 echo b4.2 > foo
71 hg ci -m b4.2 # 12
72
73 cd ../tt
74 echo % should fail new head in our branch
75 hg pull -u ../t
@@ -0,0 +1,60 b''
1 adding foo
2 marked working directory as branch branchA
3 pulling from ../t
4 requesting all changes
5 adding changesets
6 adding manifests
7 adding file changes
8 added 2 changesets with 2 changes to 1 files
9 (run 'hg update' to get a working copy)
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 % create branch B
12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 marked working directory as branch branchB
14 created new head
15 % a new branch is there
16 pulling from ../t
17 searching for changes
18 adding changesets
19 adding manifests
20 adding file changes
21 added 2 changesets with 2 changes to 1 files (+1 heads)
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 % develop both branch
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 % should succeed, no new heads
27 pulling from ../t
28 searching for changes
29 adding changesets
30 adding manifests
31 adding file changes
32 added 2 changesets with 2 changes to 1 files
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 % add an head on other branch
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 created new head
39 % should succeed only one head on our branch
40 pulling from ../t
41 searching for changes
42 adding changesets
43 adding manifests
44 adding file changes
45 added 3 changesets with 3 changes to 1 files (+1 heads)
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 created new head
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 % should fail new head in our branch
53 pulling from ../t
54 searching for changes
55 adding changesets
56 adding manifests
57 adding file changes
58 added 4 changesets with 4 changes to 1 files (+1 heads)
59 not updating, since new heads added
60 (run 'hg heads' to see heads, 'hg merge' to merge)
@@ -2091,7 +2091,7 b' def postincoming(ui, repo, modheads, opt'
2091 if modheads == 0:
2091 if modheads == 0:
2092 return
2092 return
2093 if optupdate:
2093 if optupdate:
2094 if modheads <= 1 or checkout:
2094 if (modheads <= 1 or len(repo.branchheads()) == 1) or checkout:
2095 return hg.update(repo, checkout)
2095 return hg.update(repo, checkout)
2096 else:
2096 else:
2097 ui.status(_("not updating, since new heads added\n"))
2097 ui.status(_("not updating, since new heads added\n"))
General Comments 0
You need to be logged in to leave comments. Login now