/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-08-18 07:51:58 UTC
  • Revision ID: mbp@sourcefrog.net-20050818075157-5f69075fa843d558
- add space to store revision-id in weave files

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
# repeatedly to calculate deltas.  We could perhaps have a weakref
40
40
# cache in memory to make this faster.
41
41
 
 
42
# TODO: please move the revision-string syntax stuff out of the branch
 
43
# object; it's clutter
 
44
 
42
45
 
43
46
def find_branch(f, **args):
44
47
    if f and (f.startswith('http://') or f.startswith('https://')):
101
104
    It is not necessary that f exists.
102
105
 
103
106
    Basically we keep looking up until we find the control directory or
104
 
    run into the root."""
 
107
    run into the root.  If there isn't one, raises NotBranchError.
 
108
    """
105
109
    if f == None:
106
110
        f = os.getcwd()
107
111
    elif hasattr(os.path, 'realpath'):
120
124
        head, tail = os.path.split(f)
121
125
        if head == f:
122
126
            # reached the root, whatever that may be
123
 
            raise BzrError('%r is not in a branch' % orig_f)
 
127
            raise bzrlib.errors.NotBranchError('%r is not in a branch' % orig_f)
124
128
        f = head
125
 
    
 
129
 
 
130
 
 
131
 
 
132
# XXX: move into bzrlib.errors; subclass BzrError    
126
133
class DivergedBranches(Exception):
127
134
    def __init__(self, branch1, branch2):
128
135
        self.branch1 = branch1
316
323
            self.controlfile(f, 'w').write('')
317
324
        mutter('created control directory in ' + self.base)
318
325
 
319
 
        pack_xml(Inventory(gen_root_id()), self.controlfile('inventory','w'))
 
326
        # if we want per-tree root ids then this is the place to set
 
327
        # them; they're not needed for now and so ommitted for
 
328
        # simplicity.
 
329
        pack_xml(Inventory(), self.controlfile('inventory','w'))
320
330
 
321
331
 
322
332
    def _check_format(self):
594
604
            try:
595
605
                return self.revision_store[revision_id]
596
606
            except IndexError:
597
 
                raise bzrlib.errors.NoSuchRevision(revision_id)
 
607
                raise bzrlib.errors.NoSuchRevision(self, revision_id)
598
608
        finally:
599
609
            self.unlock()
600
610
 
657
667
        from bzrlib.inventory import Inventory
658
668
        from bzrlib.xml import unpack_xml
659
669
 
660
 
        return unpack_xml(Inventory, self.inventory_store[inventory_id])
 
670
        return unpack_xml(Inventory, self.get_inventory_xml(inventory_id))
 
671
 
 
672
 
 
673
    def get_inventory_xml(self, inventory_id):
 
674
        """Get inventory XML as a file object."""
 
675
        return self.inventory_store[inventory_id]
661
676
            
662
677
 
663
678
    def get_inventory_sha1(self, inventory_id):
664
679
        """Return the sha1 hash of the inventory entry
665
680
        """
666
 
        return sha_file(self.inventory_store[inventory_id])
 
681
        return sha_file(self.get_inventory_xml(inventory_id))
667
682
 
668
683
 
669
684
    def get_revision_inventory(self, revision_id):