mercurial/discovery.py
changeset 14525 826a13720fbc
parent 14524 97d2259af787
child 14526 4276e3202585
equal deleted inserted replaced
14524:97d2259af787 14525:826a13720fbc
   157         error = None
   157         error = None
   158         for branch in branches:
   158         for branch in branches:
   159             newhs = set(newmap[branch])
   159             newhs = set(newmap[branch])
   160             oldhs = set(oldmap[branch])
   160             oldhs = set(oldmap[branch])
   161             if len(newhs) > len(oldhs):
   161             if len(newhs) > len(oldhs):
       
   162                 dhs = list(newhs - oldhs)
   162                 if error is None:
   163                 if error is None:
   163                     error = _("push creates new remote heads "
   164                     if branch != 'default':
   164                               "on branch '%s'!") % branch
   165                         error = _("push creates new remote head %s "
       
   166                                   "on branch '%s'!") % (short(dhs[0]), branch)
       
   167                     else:
       
   168                         error = _("push creates new remote head %s!"
       
   169                                   ) % short(dhs[0])
   165                     if branch in unsynced:
   170                     if branch in unsynced:
   166                         hint = _("you should pull and merge or "
   171                         hint = _("you should pull and merge or "
   167                                  "use push -f to force")
   172                                  "use push -f to force")
   168                     else:
   173                     else:
   169                         hint = _("did you forget to merge? "
   174                         hint = _("did you forget to merge? "
   170                                  "use push -f to force")
   175                                  "use push -f to force")
   171                 repo.ui.debug("new remote heads on branch '%s'\n" % branch)
   176                 repo.ui.debug("new remote heads on branch '%s'\n" % branch)
   172                 for h in (newhs - oldhs):
   177                 for h in dhs:
   173                     repo.ui.debug("new remote head %s\n" % short(h))
   178                     repo.ui.debug("new remote head %s\n" % short(h))
   174         if error:
   179         if error:
   175             raise util.Abort(error, hint=hint)
   180             raise util.Abort(error, hint=hint)
   176 
   181 
   177         # 6. Check for unsynced changes on involved branches.
   182         # 6. Check for unsynced changes on involved branches.