[PATCH 2 of 2] clone: check update rev for being True

Augie Fackler raf at durin42.com
Fri Sep 25 17:35:28 UTC 2015


On Thu, Sep 24, 2015 at 04:08:07PM -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1443135131 25200
> #      Thu Sep 24 15:52:11 2015 -0700
> # Node ID d39fa261f9d7491a3b15ca603721747904314386
> # Parent  d19a61caa7c7abb23316df0458954403f2176b13
> clone: check update rev for being True

Queued these, thanks!

>
> In 30be3aeb5344, there was an attempt to fallback to looking up the update
> revision assuming it was always a rev but the documentation states:
>
>   True means update to default rev, anything else is treated as a revision
>
> Therefore, we should only fallback to looking up the update rev if it is not
> True. This bug was found in hg-git and I couldn't think of a test that does
> this in pure Mercurial since the source repository is checked for the revision
> as well (and therefore gracefully falls back).
>
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -580,14 +580,15 @@ def clone(ui, peeropts, source, dest=Non
>                  status = None
>                  if checkout is not None:
>                      try:
>                          uprev = destrepo.lookup(checkout)
>                      except error.RepoLookupError:
> -                        try:
> -                            uprev = destrepo.lookup(update)
> -                        except error.RepoLookupError:
> -                            pass
> +                        if update is not True:
> +                            try:
> +                                uprev = destrepo.lookup(update)
> +                            except error.RepoLookupError:
> +                                pass
>                  if uprev is None:
>                      try:
>                          uprev = destrepo._bookmarks['@']
>                          update = '@'
>                          bn = destrepo[uprev].branch()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list