[MERGE REQUEST] Couple of small fixes

Jelmer Vernooij jelmer at samba.org
Tue Nov 22 23:39:16 GMT 2005


Hi Martin,

Please consider merging the following changes from my integration branch at 
http://samba.org/~jelmer/bzr/integration .

 1427 Jelmer Vernooij	2005-11-21
      Don't clear Revision.parent_ids after it has been set from the arguments
      

 1426 Jelmer Vernooij	2005-11-21
      Make get_revision_xml_file() private
      

 1425 Jelmer Vernooij	2005-11-20
      Remove methods from BzrBranch that were already implemented in Branch
      

 1424 Jelmer Vernooij	2005-11-20
      Fix error that was declared twice
      

 1423 Jelmer Vernooij	2005-11-20
      Remove some abstract methods that were no longer used.
      

 1422 Jelmer Vernooij	2005-11-18
      Remove already fixed items from TODO
      


A diff of the changes in these revisions is attached.

Cheers, Jelmer

-- 
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py	
+++ bzrlib/branch.py	
@@ -296,10 +296,6 @@
         This does not necessarily imply the revision is merge
         or on the mainline."""
         raise NotImplementedError('has_revision is abstract')
-
-    def get_revision_xml_file(self, revision_id):
-        """Return XML file object for revision object."""
-        raise NotImplementedError('get_revision_xml_file is abstract')
 
     def get_revision_xml(self, revision_id):
         raise NotImplementedError('get_revision_xml is abstract')
@@ -493,31 +489,6 @@
         """
         raise NotImplementedError('move is abstract')
 
-    def revert(self, filenames, old_tree=None, backups=True):
-        """Restore selected files to the versions from a previous tree.
-
-        backups
-            If true (default) backups are made of files before
-            they're renamed.
-        """
-        raise NotImplementedError('revert is abstract')
-
-    def pending_merges(self):
-        """Return a list of pending merges.
-
-        These are revisions that have been merged into the working
-        directory but not yet committed.
-        """
-        raise NotImplementedError('pending_merges is abstract')
-
-    def add_pending_merge(self, *revision_ids):
-        # TODO: Perhaps should check at this point that the
-        # history of the revision is actually present?
-        raise NotImplementedError('add_pending_merge is abstract')
-
-    def set_pending_merges(self, rev_list):
-        raise NotImplementedError('set_pending_merges is abstract')
-
     def get_parent(self):
         """Return the parent location of the branch.
 
@@ -989,8 +960,7 @@
                 or self.revision_store.has_id(revision_id))
 
     @needs_read_lock
-    def get_revision_xml_file(self, revision_id):
-        """See Branch.get_revision_xml_file."""
+    def _get_revision_xml_file(self, revision_id):
         if not revision_id or not isinstance(revision_id, basestring):
             raise InvalidRevisionId(revision_id=revision_id, branch=self)
         try:
@@ -998,17 +968,13 @@
         except (IndexError, KeyError):
             raise bzrlib.errors.NoSuchRevision(self, revision_id)
 
-    #deprecated
-    get_revision_xml = get_revision_xml_file
-
     def get_revision_xml(self, revision_id):
         """See Branch.get_revision_xml."""
-        return self.get_revision_xml_file(revision_id).read()
-
+        return self._get_revision_xml_file(revision_id).read()
 
     def get_revision(self, revision_id):
         """See Branch.get_revision."""
-        xml_file = self.get_revision_xml_file(revision_id)
+        xml_file = self._get_revision_xml_file(revision_id)
 
         try:
             r = bzrlib.xml5.serializer_v5.read_revision(xml_file)
@@ -1123,26 +1089,6 @@
                 else:
                     raise e
         
-    def revision_id_to_revno(self, revision_id):
-        """Given a revision id, return its revno"""
-        if revision_id is None:
-            return 0
-        history = self.revision_history()
-        try:
-            return history.index(revision_id) + 1
-        except ValueError:
-            raise bzrlib.errors.NoSuchRevision(self, revision_id)
-
-    def get_rev_id(self, revno, history=None):
-        """Find the revision id of the specified revno."""
-        if revno == 0:
-            return None
-        if history is None:
-            history = self.revision_history()
-        elif revno <= 0 or revno > len(history):
-            raise bzrlib.errors.NoSuchRevision(self, revno)
-        return history[revno - 1]
-
     def revision_tree(self, revision_id):
         """See Branch.revision_tree."""
         # TODO: refactor this to use an existing revision object
@@ -1312,22 +1258,6 @@
     def tree_config(self):
         return TreeConfig(self)
 
-    def check_revno(self, revno):
-        """\
-        Check whether a revno corresponds to any revision.
-        Zero (the NULL revision) is considered valid.
-        """
-        if revno != 0:
-            self.check_real_revno(revno)
-            
-    def check_real_revno(self, revno):
-        """\
-        Check whether a revno corresponds to a real revision.
-        Zero (the NULL revision) is considered invalid
-        """
-        if revno < 1 or revno > self.revno():
-            raise InvalidRevisionNumber(revno)
-        
     def sign_revision(self, revision_id, gpg_strategy):
         """See Branch.sign_revision."""
         plaintext = Testament.from_revision(self, revision_id).as_short_text()

=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py	
+++ bzrlib/builtins.py	
@@ -146,13 +146,13 @@
             raise BzrCommandError('You must supply either --revision or a revision_id')
         b = Branch.open_containing('.')[0]
         if revision_id is not None:
-            sys.stdout.write(b.get_revision_xml_file(revision_id).read())
+            sys.stdout.write(b.get_revision_xml(revision_id))
         elif revision is not None:
             for rev in revision:
                 if rev is None:
                     raise BzrCommandError('You cannot specify a NULL revision.')
                 revno, rev_id = rev.in_history(b)
-                sys.stdout.write(b.get_revision_xml_file(rev_id).read())
+                sys.stdout.write(b.get_revision_xml(rev_id))
     
 
 class cmd_revno(Command):

=== modified file 'bzrlib/errors.py'
--- bzrlib/errors.py	
+++ bzrlib/errors.py	
@@ -258,15 +258,6 @@
         self.not_ancestor_id = not_ancestor_id
 
 
-class NotAncestor(BzrError):
-    def __init__(self, rev_id, not_ancestor_id):
-        self.rev_id = rev_id
-        self.not_ancestor_id = not_ancestor_id
-        msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id, 
-                                                        rev_id)
-        BzrError.__init__(self, msg)
-
-
 class InstallFailed(BzrError):
     def __init__(self, revisions):
         msg = "Could not install revisions:\n%s" % " ,".join(revisions)

=== modified file 'bzrlib/revision.py'
--- bzrlib/revision.py	
+++ bzrlib/revision.py	
@@ -45,9 +45,9 @@
         self.revision_id = revision_id
         self.properties = properties or {}
         self._check_properties()
-        self.__dict__.update(args)
         self.parent_ids = []
         self.parent_sha1s = []
+        self.__dict__.update(args)
 
     def __repr__(self):
         return "<Revision id %s>" % self.revision_id

=== modified file 'bzrlib/selftest/test_revision_info.py'
--- bzrlib/selftest/test_revision_info.py	
+++ bzrlib/selftest/test_revision_info.py	
@@ -92,9 +92,9 @@
         b.working_tree().commit('Commit three', rev_id='a at r-0-3')
 
         revs = {
-            1:b.get_revision_xml_file('a at r-0-1').read(),
-            2:b.get_revision_xml_file('a at r-0-2').read(),
-            3:b.get_revision_xml_file('a at r-0-3').read()
+            1:b.get_revision_xml('a at r-0-1'),
+            2:b.get_revision_xml('a at r-0-2'),
+            3:b.get_revision_xml('a at r-0-3')
         }
 
         self.check_output(revs[1], 'cat-revision', 'a at r-0-1')

=== modified file 'bzrlib/selftest/testfetch.py'
--- bzrlib/selftest/testfetch.py	
+++ bzrlib/selftest/testfetch.py	
@@ -31,7 +31,7 @@
 
 def has_revision(branch, revision_id):
     try:
-        branch.get_revision_xml_file(revision_id)
+        branch.get_revision_xml(revision_id)
         return True
     except bzrlib.errors.NoSuchRevision:
         return False

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051123/6aef002c/attachment.pgp 


More information about the bazaar mailing list