~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Martin Pool
  • Date: 2007-10-08 09:37:43 UTC
  • mto: This revision was merged to the branch mainline in revision 2899.
  • Revision ID: mbp@sourcefrog.net-20071008093743-b8m904v0grm602kw
More cleanups of dirstate work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1901
1901
                if current_new_minikind == 't':
1902
1902
                    fingerprint = current_new[1].reference_revision or ''
1903
1903
                else:
1904
 
                    # XXX: mbp- why are we erasing the fingerprint?  surely we
1905
 
                    # should be leaving it alone when updating, if one is
1906
 
                    # already present?  only clear it when adding a new
1907
 
                    # record.
 
1904
                    # We normally only insert or remove records, or update
 
1905
                    # them when it has significantly changed.  Then we want to
 
1906
                    # erase its fingerprint.  Unaffected records should
 
1907
                    # normally not be updated at all.
1908
1908
                    fingerprint = ''
1909
1909
            else:
1910
1910
                # for safety disable variables
1911
 
                del new_path_utf8, new_dirname, new_basename, new_id, new_entry_key
 
1911
                new_path_utf8 = new_dirname = new_basename = new_id = \
 
1912
                    new_entry_key = new_dir_parts = None
1912
1913
            # 5 cases, we dont have a value that is strictly greater than everything, so
1913
1914
            # we make both end conditions explicit
1914
1915
            if current_old is None:
2014
2015
        :param minikind: The type for the entry ('f' == 'file', 'd' ==
2015
2016
                'directory'), etc.
2016
2017
        :param executable: Should the executable bit be set?
2017
 
        :param fingerprint: Simple fingerprint for new entry.
 
2018
        :param fingerprint: Simple fingerprint for new entry: sha1 for files, 
 
2019
            referenced revision id for subtrees, etc.
2018
2020
        :param packed_stat: Packed stat value for new entry.
2019
2021
        :param size: Size information for new entry
2020
2022
        :param path_utf8: key[0] + '/' + key[1], just passed in to avoid doing
2029
2031
        # XXX: Some callers pass '' as the packed_stat, and it seems to be
2030
2032
        # sometimes present in the dirstate - this seems oddly inconsistent.
2031
2033
        # mbp 20071008
2032
 
        if (fingerprint is '') != (packed_stat in (DirState.NULLSTAT, '')):
2033
 
            raise AssertionError("either both fingerprint and packed_stat "
2034
 
                "should be be supplied to update_minimal, or neither: %r, %r"
2035
 
                % (fingerprint, packed_stat))
2036
2034
        entry_index, present = self._find_entry_index(key, block)
2037
2035
        new_details = (minikind, fingerprint, size, executable, packed_stat)
2038
2036
        id_index = self._get_id_index()