Rev 4586: Cleanup. in file:///home/vila/src/bzr/reviews/revspec-dwim/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Oct 22 11:46:18 BST 2009


At file:///home/vila/src/bzr/reviews/revspec-dwim/

------------------------------------------------------------
revno: 4586
revision-id: v.ladeuil+lp at free.fr-20091022104618-108neslaql3mu531
parent: fullermd at over-yonder.net-20091010050735-bz43fgmdm166d4kc
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: revspec-dwim
timestamp: Thu 2009-10-22 12:46:18 +0200
message:
  Cleanup.
  
  * bzrlib/revisionspec.py:
  (RevisionSpec_dwim._try_spectype): No need to forbid inheritance.
  (RevisionSpec_dwim._match_on): Out wants_revision_history
  attribute is never used, no need to pretend we use it.
-------------- next part --------------
=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py	2009-10-10 04:56:37 +0000
+++ b/bzrlib/revisionspec.py	2009-10-22 10:46:18 +0000
@@ -113,8 +113,6 @@
         return RevisionInfo(branch, revno, revision_id)
 
 
-# classes in this list should have a "prefix" attribute, against which
-# string specs are matched
 _revno_regex = None
 
 
@@ -289,11 +287,8 @@
     """
 
     help_txt = None
-    # Default to False to save building the history in the revno case
-    wants_revision_history = False
 
-    # Util
-    def __try_spectype(self, rstype, spec, branch):
+    def _try_spectype(self, rstype, spec, branch):
         rs = rstype(spec, _internal=True)
         # Hit in_history to find out if it exists, or we need to try the
         # next type.
@@ -309,34 +304,31 @@
             _revno_regex = re.compile(r'^(?:(\d+(\.\d+)*)|-\d+)(:.*)?$')
         if _revno_regex.match(spec) is not None:
             try:
-                return self.__try_spectype(RevisionSpec_revno, spec, branch)
+                return self._try_spectype(RevisionSpec_revno, spec, branch)
             except errors.InvalidRevisionSpec:
                 pass
 
-        # It's not a revno, so now we need this
-        self.wants_revision_history = True
-
         # OK, next let's try for a tag
         try:
-            return self.__try_spectype(RevisionSpec_tag, spec, branch)
+            return self._try_spectype(RevisionSpec_tag, spec, branch)
         except (errors.NoSuchTag, errors.TagsNotSupported):
             pass
 
         # Maybe it's a revid?
         try:
-            return self.__try_spectype(RevisionSpec_revid, spec, branch)
+            return self._try_spectype(RevisionSpec_revid, spec, branch)
         except errors.InvalidRevisionSpec:
             pass
 
         # Perhaps a date?
         try:
-            return self.__try_spectype(RevisionSpec_date, spec, branch)
+            return self._try_spectype(RevisionSpec_date, spec, branch)
         except errors.InvalidRevisionSpec:
             pass
 
         # OK, last try, maybe it's a branch
         try:
-            return self.__try_spectype(RevisionSpec_branch, spec, branch)
+            return self._try_spectype(RevisionSpec_branch, spec, branch)
         except errors.NotBranchError:
             pass
 
@@ -906,5 +898,7 @@
 _register_revspec(RevisionSpec_branch)
 _register_revspec(RevisionSpec_submit)
 
+# classes in this list should have a "prefix" attribute, against which
+# string specs are matched
 SPEC_TYPES = symbol_versioning.deprecated_list(
     symbol_versioning.deprecated_in((1, 12, 0)), "SPEC_TYPES", [])



More information about the bazaar-commits mailing list