comparison mercurial/localrepo.py @ 3682:20912eb2667d

reorder tests in prepush It's more useful to show the new branches message than the unsynced changes message.
author Matt Mackall <mpm@selenic.com>
date Sun, 19 Nov 2006 16:32:36 -0600
parents 6990e499d71a
children 975c2469c316
comparison
equal deleted inserted replaced
3681:05d877dfd33d 3682:20912eb2667d
1296 1296
1297 def prepush(self, remote, force, revs): 1297 def prepush(self, remote, force, revs):
1298 base = {} 1298 base = {}
1299 remote_heads = remote.heads() 1299 remote_heads = remote.heads()
1300 inc = self.findincoming(remote, base, remote_heads, force=force) 1300 inc = self.findincoming(remote, base, remote_heads, force=force)
1301 if not force and inc:
1302 self.ui.warn(_("abort: unsynced remote changes!\n"))
1303 self.ui.status(_("(did you forget to sync?"
1304 " use push -f to force)\n"))
1305 return None, 1
1306 1301
1307 update, updated_heads = self.findoutgoing(remote, base, remote_heads) 1302 update, updated_heads = self.findoutgoing(remote, base, remote_heads)
1308 if revs is not None: 1303 if revs is not None:
1309 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) 1304 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1310 else: 1305 else:
1320 and remote_heads != [nullid]: 1315 and remote_heads != [nullid]:
1321 self.ui.warn(_("abort: push creates new remote branches!\n")) 1316 self.ui.warn(_("abort: push creates new remote branches!\n"))
1322 self.ui.status(_("(did you forget to merge?" 1317 self.ui.status(_("(did you forget to merge?"
1323 " use push -f to force)\n")) 1318 " use push -f to force)\n"))
1324 return None, 1 1319 return None, 1
1320
1321 if not force and inc:
1322 self.ui.warn(_("abort: unsynced remote changes!\n"))
1323 self.ui.status(_("(did you forget to sync?"
1324 " use push -f to force)\n"))
1325 return None, 1
1325 1326
1326 if revs is None: 1327 if revs is None:
1327 cg = self.changegroup(update, 'push') 1328 cg = self.changegroup(update, 'push')
1328 else: 1329 else:
1329 cg = self.changegroupsubset(update, revs, 'push') 1330 cg = self.changegroupsubset(update, revs, 'push')