##// END OF EJS Templates
prepush: add more precise error messages...
Benoit Boissinot -
r10396:65a90c8e default
parent child Browse files
Show More
@@ -1491,7 +1491,7 b' class localrepository(repo.repository):'
1491 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1491 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1492 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1492 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1493
1493
1494 def checkbranch(lheads, rheads, updatelb):
1494 def checkbranch(lheads, rheads, updatelb, branchname=None):
1495 '''
1495 '''
1496 check whether there are more local heads than remote heads on
1496 check whether there are more local heads than remote heads on
1497 a specific branch.
1497 a specific branch.
@@ -1527,9 +1527,18 b' class localrepository(repo.repository):'
1527 warn = 1
1527 warn = 1
1528
1528
1529 if warn:
1529 if warn:
1530 self.ui.warn(_("abort: push creates new remote heads!\n"))
1530 if branchname is not None:
1531 self.ui.status(_("(did you forget to merge?"
1531 msg = _("abort: push creates new remote heads"
1532 " use push -f to force)\n"))
1532 " on branch '%s'!\n") % branchname
1533 else:
1534 msg = _("abort: push creates new remote heads!\n")
1535 self.ui.warn(msg)
1536 if len(lheads) > len(rheads):
1537 self.ui.status(_("(did you forget to merge?"
1538 " use push -f to force)\n"))
1539 else:
1540 self.ui.status(_("(you should pull and merge or"
1541 " use push -f to force)\n"))
1533 return False
1542 return False
1534 return True
1543 return True
1535
1544
@@ -1570,7 +1579,7 b' class localrepository(repo.repository):'
1570 for branch, lheads in localbrheads.iteritems():
1579 for branch, lheads in localbrheads.iteritems():
1571 if branch in remotebrheads:
1580 if branch in remotebrheads:
1572 rheads = remotebrheads[branch]
1581 rheads = remotebrheads[branch]
1573 if not checkbranch(lheads, rheads, update):
1582 if not checkbranch(lheads, rheads, update, branch):
1574 return None, 0
1583 return None, 0
1575 else:
1584 else:
1576 if not checkbranch(heads, remote_heads, update):
1585 if not checkbranch(heads, remote_heads, update):
@@ -2,8 +2,8 b' updating to branch default'
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 pushing to ../a
3 pushing to ../a
4 searching for changes
4 searching for changes
5 abort: push creates new remote heads!
5 abort: push creates new remote heads on branch 'default'!
6 (did you forget to merge? use push -f to force)
6 (you should pull and merge or use push -f to force)
7 pulling from ../a
7 pulling from ../a
8 searching for changes
8 searching for changes
9 adding changesets
9 adding changesets
@@ -13,7 +13,7 b' added 1 changesets with 1 changes to 1 f'
13 (run 'hg heads' to see heads, 'hg merge' to merge)
13 (run 'hg heads' to see heads, 'hg merge' to merge)
14 pushing to ../a
14 pushing to ../a
15 searching for changes
15 searching for changes
16 abort: push creates new remote heads!
16 abort: push creates new remote heads on branch 'default'!
17 (did you forget to merge? use push -f to force)
17 (did you forget to merge? use push -f to force)
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 (branch merge, don't forget to commit)
19 (branch merge, don't forget to commit)
@@ -35,7 +35,7 b' 0 files updated, 1 files merged, 0 files'
35 (branch merge, don't forget to commit)
35 (branch merge, don't forget to commit)
36 pushing to ../c
36 pushing to ../c
37 searching for changes
37 searching for changes
38 abort: push creates new remote heads!
38 abort: push creates new remote heads on branch 'default'!
39 (did you forget to merge? use push -f to force)
39 (did you forget to merge? use push -f to force)
40 1
40 1
41 pushing to ../c
41 pushing to ../c
@@ -44,12 +44,12 b' no changes found'
44 0
44 0
45 pushing to ../c
45 pushing to ../c
46 searching for changes
46 searching for changes
47 abort: push creates new remote heads!
47 abort: push creates new remote heads on branch 'default'!
48 (did you forget to merge? use push -f to force)
48 (you should pull and merge or use push -f to force)
49 1
49 1
50 pushing to ../c
50 pushing to ../c
51 searching for changes
51 searching for changes
52 abort: push creates new remote heads!
52 abort: push creates new remote heads on branch 'default'!
53 (did you forget to merge? use push -f to force)
53 (did you forget to merge? use push -f to force)
54 1
54 1
55 pushing to ../c
55 pushing to ../c
@@ -106,8 +106,8 b' 1'
106 % fail on multiple head push
106 % fail on multiple head push
107 pushing to ../f
107 pushing to ../f
108 searching for changes
108 searching for changes
109 abort: push creates new remote heads!
109 abort: push creates new remote heads on branch 'a'!
110 (did you forget to merge? use push -f to force)
110 (you should pull and merge or use push -f to force)
111 1
111 1
112 % push replacement head on existing branches
112 % push replacement head on existing branches
113 pushing to ../f
113 pushing to ../f
@@ -153,8 +153,8 b' adding c'
153 created new head
153 created new head
154 pushing to h
154 pushing to h
155 searching for changes
155 searching for changes
156 abort: push creates new remote heads!
156 abort: push creates new remote heads on branch 'default'!
157 (did you forget to merge? use push -f to force)
157 (you should pull and merge or use push -f to force)
158
158
159 % check prepush logic with merged branches
159 % check prepush logic with merged branches
160 marked working directory as branch a
160 marked working directory as branch a
@@ -167,6 +167,6 b' 1 files updated, 0 files merged, 0 files'
167 (branch merge, don't forget to commit)
167 (branch merge, don't forget to commit)
168 pushing to j
168 pushing to j
169 searching for changes
169 searching for changes
170 abort: push creates new remote heads!
170 abort: push creates new remote heads on branch 'a'!
171 (did you forget to merge? use push -f to force)
171 (you should pull and merge or use push -f to force)
172
172
@@ -151,7 +151,7 b' adding file changes'
151 added 1 changesets with 1 changes to 1 files
151 added 1 changesets with 1 changes to 1 files
152 % push -f
152 % push -f
153 committing subrepository s
153 committing subrepository s
154 abort: push creates new remote heads!
154 abort: push creates new remote heads on branch 'default'!
155 pushing ...sub/t
155 pushing ...sub/t
156 pushing ...subrepo ss
156 pushing ...subrepo ss
157 searching for changes
157 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now