Jannis Leidel avatar Jannis Leidel committed 88f6006

Fixed ticket #13, Added matching method names for parsing the bundled instruction file

Comments (0)

Files changed (1)

                         fp = open(vcs_bundle_file)
                         content = fp.read()
                         fp.close()
-                        url, rev = vcs_backend().parse_checkout_text(content)
+                        url, rev = vcs_backend().parse_vcs_bundle_file(content)
                         break
                 if url:
                     url = '%s+%s@%s' % (vc_type, url, rev)
         url = urlparse.urlunsplit((scheme, netloc, path, query, ''))
         return url, rev
 
+    def parse_vcs_bundle_file(self, content):
+        """
+        Takes the contents of the bundled text file that explains how to revert
+        the stripped off version control data of the given package and returns
+        the URL and revision of it.
+        """
+        raise NotImplementedError
+
     def obtain(self, dest):
+        """
+        Called when installing or updating an editable package, takes the
+        source path of the checkout.
+        """
         raise NotImplementedError
 
     def unpack(self, location):
             return url, 'unknown'
         return url, match.group(1)
 
-    def parse_checkout_text(self, text):
-        for line in text.splitlines():
+    def parse_vcs_bundle_file(self, content):
+        for line in content.splitlines():
             if not line.strip() or line.strip().startswith('#'):
                 continue
             match = re.search(r'^-r\s*([^ ])?', line)
         assert not location.rstrip('/').endswith('.git'), 'Bad directory: %s' % location
         return self.get_url(location), self.get_revision(location)
 
-    def parse_clone_text(self, text):
+    def parse_vcs_bundle_file(self, content):
         url = rev = None
-        for line in text.splitlines():
+        for line in content.splitlines():
             if not line.strip() or line.strip().startswith('#'):
                 continue
             url_match = re.search(r'git\s*remote\s*add\s*origin(.*)\s*-f', line)
         assert not location.rstrip('/').endswith('.hg'), 'Bad directory: %s' % location
         return self.get_url(location), self.get_revision(location)
 
-    def parse_clone_text(self, text):
+    def parse_vcs_bundle_file(self, content):
         url = rev = None
-        for line in text.splitlines():
+        for line in content.splitlines():
             if not line.strip() or line.strip().startswith('#'):
                 continue
             url_match = re.search(r'hg\s*pull\s*(.*)\s*', line)
         assert not location.rstrip('/').endswith('.bzr'), 'Bad directory: %s' % location
         return self.get_url(location), self.get_revision(location)
 
-    def parse_clone_text(self, text):
+    def parse_vcs_bundle_file(self, content):
         url = rev = None
-        for line in text.splitlines():
+        for line in content.splitlines():
             if not line.strip() or line.strip().startswith('#'):
                 continue
             match = re.search(r'^bzr\s*branch\s*-r\s*(\d*)', line)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.