[rfc] [patch] another small cleanup
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 11 21:36:16 GMT 2006
Denys Duchier wrote:
> Another small cleanup from my bzr.cleanup branch at:
>
> http://delta.univ-orleans.fr/~duchier/bzr/bzr.cleanup/
>
> ------------------------------------------------------------
> revno: 1501
> committer: Denys Duchier <denys.duchier at mozart-oz.org>
> branch nick: bzr.cleanup
> timestamp: Wed 2006-01-11 20:58:59 +0100
> message:
> hashcache: new constants and improved comment
>
>
>
>
> ------------------------------------------------------------------------
>
> === modified file 'bzrlib/hashcache.py'
> --- bzrlib/hashcache.py
> +++ bzrlib/hashcache.py
> @@ -38,6 +38,8 @@
> from bzrlib.errors import BzrError
>
>
> +FP_MTIME_COLUMN = 1
> +FP_CTIME_COLUMN = 2
> FP_MODE_COLUMN = 5
>
> def _fingerprint(abspath):
> @@ -175,10 +177,18 @@
> raise BzrError("file %r: unknown file stat mode: %o"%(abspath,mode))
>
> now = int(time.time())
> - if file_fp[1] >= now or file_fp[2] >= now:
> + if file_fp[FP_MTIME_COLUMN] >= now or file_fp[FP_CTIME_COLUMN] >= now:
> # changed too recently; can't be cached. we can
> # return the result and it could possibly be cached
> # next time.
> + #
> + # the point is that we only want to cache when we are sure that any
> + # subsequent modifications of the file can be detected. If a
> + # modification neither changes the inode, the device, the size, nor
> + # the mode, then we can only distinguish it by time; therefore we
> + # need to let sufficient time elapse before we may cache this entry
> + # again. If we didn't do this, then, for example, a very quick 1
> + # byte replacement in the file might go undetected.
> self.danger_count += 1
> if cache_fp:
> self.removed_count += 1
>
>
>
> ------------------------------------------------------------------------
>
>
>
> Cheers,
>
> --Denys
+1 from me. (not merged yet)
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060111/203fa0b2/attachment.pgp
More information about the bazaar
mailing list