~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
# Author: Martin Pool <mbp@canonical.com>
20
20
 
99
99
    AbsentContentFactory,
100
100
    adapter_registry,
101
101
    ContentFactory,
102
 
    sort_groupcompress,
103
102
    VersionedFile,
104
103
    )
105
104
from bzrlib.weavefile import _read_weave_v5, write_weave_v5
322
321
            new_versions = tsort.topo_sort(parents)
323
322
            new_versions.extend(set(versions).difference(set(parents)))
324
323
            versions = new_versions
325
 
        elif ordering == 'groupcompress':
326
 
            parents = self.get_parent_map(versions)
327
 
            new_versions = sort_groupcompress(parents)
328
 
            new_versions.extend(set(versions).difference(set(parents)))
329
 
            versions = new_versions
330
324
        for version in versions:
331
325
            if version in self:
332
326
                yield WeaveContentFactory(version, self)
410
404
        version_id
411
405
            Symbolic name for this version.
412
406
            (Typically the revision-id of the revision that added it.)
413
 
            If None, a name will be allocated based on the hash. (sha1:SHAHASH)
414
407
 
415
408
        parents
416
409
            List or set of direct parent version numbers.
426
419
            sha1 = sha_strings(lines)
427
420
        if sha1 == nostore_sha:
428
421
            raise errors.ExistingContent
429
 
        if version_id is None:
430
 
            version_id = "sha1:" + sha1
431
422
        if version_id in self._name_map:
432
423
            return self._check_repeated_add(version_id, parents, lines, sha1)
433
424
 
584
575
            version_ids = self.versions()
585
576
        version_ids = set(version_ids)
586
577
        for lineno, inserted, deletes, line in self._walk_internal(version_ids):
587
 
            if inserted not in version_ids: continue
 
578
            # if inserted not in version_ids then it was inserted before the
 
579
            # versions we care about, but because weaves cannot represent ghosts
 
580
            # properly, we do not filter down to that
 
581
            # if inserted not in version_ids: continue
588
582
            if line[-1] != '\n':
589
583
                yield line + '\n', inserted
590
584
            else:
975
969
        super(WeaveFile, self).insert_record_stream(stream)
976
970
        self._save()
977
971
 
 
972
    @deprecated_method(one_five)
 
973
    def join(self, other, pb=None, msg=None, version_ids=None,
 
974
             ignore_missing=False):
 
975
        """Join other into self and save."""
 
976
        super(WeaveFile, self).join(other, pb, msg, version_ids, ignore_missing)
 
977
        self._save()
 
978
 
978
979
 
979
980
def _reweave(wa, wb, pb=None, msg=None):
980
981
    """Combine two weaves and return the result.