Patchwork [3,of,3] obsolete: factorise troubles detection during push

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 17, 2012, 2:41 p.m.
Message ID <cf9a7e096a42dd13e6a3.1355755279@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/154/
State Superseded, archived
Commit df1b37c8ae679693a0829e231d359f1dc20bb78e
Headers show

Comments

Pierre-Yves David - Dec. 17, 2012, 2:41 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355754115 -3600
# Node ID cf9a7e096a42dd13e6a34ddd5d730f231a946c3e
# Parent  5eca666b0078061addf65b5f431207db21839ebd
obsolete: factorise troubles detection during push

The use of the two methods introduced earlier allows a factorisation of the
push code preventing push of troubled changeset.
Pierre-Yves David - Dec. 22, 2012, 1:51 a.m.
On 17 d?c. 2012, at 15:41, pierre-yves.david at logilab.fr wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1355754115 -3600
> # Node ID cf9a7e096a42dd13e6a34ddd5d730f231a946c3e
> # Parent  5eca666b0078061addf65b5f431207db21839ebd
> obsolete: factorise troubles detection during push
> 
> The use of the two methods introduced earlier allows a factorisation of the
> push code preventing push of troubled changeset.
> 
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1914,27 +1914,23 @@ class localrepository(object):
>                         # if self.obsstore == False --> no obsolete
>                         # then, save the iteration
>                         if unfi.obsstore:
>                             # this message are here for 80 char limit reason
>                             mso = _("push includes obsolete changeset: %s!")
> -                            msu = _("push includes unstable changeset: %s!")
> -                            msb = _("push includes bumped changeset: %s!")
> -                            msd = _("push includes divergent changeset: %s!")
> +                            mst = "push includes %s changeset: %s!"

We need to keep the full string around for i18n tool to see them.

fixed version here: http://hg-lab.logilab.org/wip/hg/rev/3cf84ea7a35e

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1914,27 +1914,23 @@  class localrepository(object):
                         # if self.obsstore == False --> no obsolete
                         # then, save the iteration
                         if unfi.obsstore:
                             # this message are here for 80 char limit reason
                             mso = _("push includes obsolete changeset: %s!")
-                            msu = _("push includes unstable changeset: %s!")
-                            msb = _("push includes bumped changeset: %s!")
-                            msd = _("push includes divergent changeset: %s!")
+                            mst = "push includes %s changeset: %s!"
                             # If we are to push if there is at least one
                             # obsolete or unstable changeset in missing, at
                             # least one of the missinghead will be obsolete or
                             # unstable. So checking heads only is ok
                             for node in outgoing.missingheads:
                                 ctx = unfi[node]
                                 if ctx.obsolete():
                                     raise util.Abort(mso % ctx)
-                                elif ctx.unstable():
-                                    raise util.Abort(msu % ctx)
-                                elif ctx.bumped():
-                                    raise util.Abort(msb % ctx)
-                                elif ctx.divergent():
-                                    raise util.Abort(msd % ctx)
+                                elif ctx.troubled():
+                                    raise util.Abort(_(mst)
+                                                     % (ctx.troubles()[0],
+                                                        ctx))
                         discovery.checkheads(unfi, remote, outgoing,
                                              remoteheads, newbranch,
                                              bool(inc))
 
                     # create a changegroup from local