Rev 4588: A bit more tweaks. in file:///home/vila/src/bzr/reviews/revspec-dwim/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Oct 22 17:03:25 BST 2009


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

------------------------------------------------------------
revno: 4588
revision-id: v.ladeuil+lp at free.fr-20091022160325-qy5bvqnru5e518hx
parent: v.ladeuil+lp at free.fr-20091022143025-1h13yp0z8whcmhco
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: revspec-dwim
timestamp: Thu 2009-10-22 18:03:25 +0200
message:
  A bit more tweaks.
  
  * bzrlib/revisionspec.py:
  (RevisionSpec_dwim._try_spectype): We don't need spec as a
  parameter since we know it's ours.
  (RevisionSpec_dwim._match_on): Use the helper.
-------------- next part --------------
=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py	2009-10-22 14:30:25 +0000
+++ b/bzrlib/revisionspec.py	2009-10-22 16:03:25 +0000
@@ -299,33 +299,29 @@
 
     help_txt = None
 
-    def _try_spectype(self, rstype, spec, branch):
-        rs = rstype(spec, _internal=True)
+    def _try_spectype(self, rstype, branch):
+        rs = rstype(self.spec, _internal=True)
         # Hit in_history to find out if it exists, or we need to try the
         # next type.
         return rs.in_history(branch)
 
     def _match_on(self, branch, revs):
         """Run the lookup and see what we can get."""
-        spec = self.spec
 
         # First, see if it's a revno
         global _revno_regex
         if _revno_regex is None:
             _revno_regex = re.compile(r'^(?:(\d+(\.\d+)*)|-\d+)(:.*)?$')
-        if _revno_regex.match(spec) is not None:
+        if _revno_regex.match(self.spec) is not None:
             try:
-                return self._try_spectype(RevisionSpec_revno, spec, branch)
+                return self._try_spectype(RevisionSpec_revno, branch)
             except RevisionSpec_revno.dwim_catchable_exceptions:
                 pass
 
         # Next see what has been registered
         for rs_class in dwim_revspecs:
             try:
-                rs = rs_class(self.spec, _internal=True)
-                # Hit in_history to find out if it exists, or we need to try
-                # the next type.
-                return rs.in_history(branch)
+                return self._try_spectype(rs_class, branch)
             except rs_class.dwim_catchable_exceptions:
                 pass
 



More information about the bazaar-commits mailing list