[PATCH] speed up bail_if_changed a tiny bit
blacktrash at gmx.net
Thu Jul 19 09:52:26 CDT 2007
* Alexis S. L. Carvalho on Thursday, July 19, 2007 at 09:36:47 -0300
> Thus spake Christian Ebert:
>> 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?
I wouldn't know ;) My logic was 1 comparison vs. potentially 4.
> My main concern is that
> [, , , ] != (, , , ), so it gets a tiny bit easier
> to break this...
Well, /at the moment/ status() returns a tuple. I just happened
to stumble over it, but, anyway, my logic is flawed most of the
time, and the proposal was somehow against my personal
preferences, as I like the readability of the original code.
I withdraw everything, and assert the contrary ;)
keyword extension for Mercurial (http://selenic.com/mercurial):
Mercurial crew development repository + keyword extension:
More information about the Mercurial-devel