newly added files always trigger IN_MEMORY_MODIFIED
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
John A Meinel |
Bug Description
A while back, Robert added a nice change to 'bzr status' so that we would not compute the 'sha1' of files which are newly added. The code looks like this:
if (stat_value.
and stat_value.st_ctime < self._cutoff_time
and len(entry[1]) > 1
and entry[1][1][0] != 'a'):
# Could check for size changes for further optimised
# avoidance of sha1's. However the most prominent case of
# over-shaing is during initial add, which this catches.
else:
...
self.
return link_or_sha1
However, this causes us to cache the file using the NULLSTAT, and then set DirState.
We probably want a bit of an overhaul here anyway, since we shouldn't be caching these sha1 values, and instead should just be using the "it is the same/different as the last commit" logic. Regardless, this makes 'bzr status' in a tree with added files *always* rewrite the dirstate file. Which is definitely bad.
Related branches
- Jelmer Vernooij (community): Approve (code)
- bzr-core: Pending requested
-
Diff: 302 lines (+84/-49)5 files modifiedbzrlib/_dirstate_helpers_pyx.pyx (+16/-4)
bzrlib/dirstate.py (+6/-1)
bzrlib/tests/test__dirstate_helpers.py (+23/-7)
bzrlib/tests/test_dirstate.py (+33/-37)
doc/en/release-notes/bzr-2.4.txt (+6/-0)
Changed in bzr: | |
status: | In Progress → Fix Released |
milestone: | none → 2.4b2 |
A possible patch, basically, just short-cut out if we aren't actually updating the new data.
=== modified file 'bzrlib/ _dirstate_ helpers_ pyx.pyx' _dirstate_ helpers_ pyx.pyx 2010-08-27 18:02:22 +0000 _dirstate_ helpers_ pyx.pyx 2011-04-19 12:58:26 +0000
entry[ 1][0] = ('f', link_or_sha1, stat_value.st_size,
executable, packed_stat)
link_ or_sha1 = None
entry[ 1][0] = ('d', '', 0, False, packed_stat)
--- bzrlib/
+++ bzrlib/
@@ -916,8 +916,12 @@
else:
- entry[1][0] = ('f', '', stat_value.st_size,
- executable, DirState.NULLSTAT)
+ new = ('f', '', stat_value.st_size, executable, DirState.NULLSTAT)
+ if entry[1][0] == new:
+ # We explicitly return early here, because we aren't changing
+ # anything, so we don't want to set IN_MEMORY_MODIFIED
+ return None
+ entry[1][0] = new
elif minikind == c'd':