[PATCH] speed up bail_if_changed a tiny bit

Alexis S. L. Carvalho alexis at cecm.usp.br
Thu Jul 19 07:36:47 CDT 2007


Thus spake Christian Ebert:
> # HG changeset patch
> # User Christian Ebert <blacktrash at gmx.net>
> # Date 1184842538 -7200
> # Node ID a8d574c457f291fb86686c4a98b1c144427a4993
> # Parent  382520bacc17886e0e2fe7fb798a0a5218cf9db1
> speed up bail_if_changed a tiny bit
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -431,8 +431,7 @@ def runcommand(ui, options, cmd, cmdfunc
>          return checkargs()
>  
>  def bail_if_changed(repo):
> -    modified, added, removed, deleted = repo.status()[:4]
> -    if modified or added or removed or deleted:
> +    if repo.status()[:4] != ([], [], [], []):

Does this actually make a difference?  My main concern is that
[[], [], [], []] != ([], [], [], []), so it gets a tiny bit easier
to break this...

Alexis


More information about the Mercurial-devel mailing list