[PATCH 2 of 8] push: refuse to push obsolete changeset

Augie Fackler raf at durin42.com
Thu Jul 5 20:08:03 CDT 2012


On Jul 5, 2012, at 8:27 PM, Pierre-Yves David wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1341532000 -7200
> # Node ID eb9bc47c436b0719a45503d0577a7864ccccbd4f
> # Parent  4afb28fd4010adcb5cb98017c237e34ebcf486bf
> push: refuse to push obsolete changeset
> 
> This is a first version. Simple but not very efficient.
> 
> Beware that this changeset introduce the "obsolete" word in the UI.

s/Beware/Note/ IMO

> 
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1732,6 +1732,13 @@
>                 else:
>                     # something to push
>                     if not force:
> +                        # avoid iterate missing for peanut

Not sure what this comment means.

> +                        if self.obsstore:
> +                            msg = "push includes an obsolete changeset: %s!"

Why is this string outlined rather than inside the util.Abort(_(…))?

> +                            for node in outgoing.missing:
> +                                ctx = self[node]
> +                                if ctx.obsolete():
> +                                    raise util.Abort(_(msg) % ctx)
>                         discovery.checkheads(self, remote, outgoing,
>                                              remoteheads, newbranch,
>                                              bool(inc))
> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -171,10 +171,16 @@
>   $ hg -R tmpb push tmpd
>   pushing to tmpd
>   searching for changes
> +  abort: push includes an obsolete changeset: cdbce2fbb163!
> +  [255]
> +  $ hg -R tmpd debugobsolete
> +  $ hg -R tmpb push tmpd --rev 5601fb93a350 --rev 245bde4270cd
> +  pushing to tmpd
> +  searching for changes
>   adding changesets
>   adding manifests
>   adding file changes
> -  added 6 changesets with 6 changes to 6 files (+3 heads)
> +  added 4 changesets with 4 changes to 4 files (+1 heads)
>   $ hg -R tmpd debugobsolete
>   ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
>   cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list