[PATCH] speed up bail_if_changed a tiny bit

Matt Mackall mpm at selenic.com
Thu Jul 19 09:42:16 CDT 2007


On Thu, Jul 19, 2007 at 09:36:47AM -0300, Alexis S. L. Carvalho wrote:
> 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...

Also: harder to read.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list