Steve Losh avatar Steve Losh committed 5235195

repo: Add some simple docstrings for the Repo classes.

Comments (0)

Files changed (1)

lib/gorilla/guts/repo.py

 import os, shutil, subprocess, urllib
 
+
 class MercurialRepo(object):
     def __init__(self, path, sources):
         self.path = path
         self.command = ['hg', '-R', self.path]
     
     def clone(self):
+        '''Clone the repository from one of the appropriate servers.
+        '''
         command = ['hg', 'clone', self.sources[0], self.path, '--noupdate']
         
         rc = subprocess.call(command, shell=False, stdout=subprocess.PIPE)
         return rc == 0
     
     def pull(self):
+        '''Pull updates from one of the appropriate servers.
+        '''
         command = self.command + ['pull', self.sources[0]]
         
         rc = subprocess.call(command, shell=False, stdout=subprocess.PIPE)
         return rc == 0
     
     def update(self, version):
+        '''Update the working directory to the specified version.
+        '''
         version = 'tip' if version == 'latest' else version
         command = self.command + ['update', version]
         
     
     @property
     def tags(self):
+        '''A list of tags in this repository.
+        '''
         command = self.command + ['tags', '--quiet']
         proc = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE)
         
         output = proc.communicate()[0]
-        return [t.strip() for t in output.splitlines() if t.strip() != 'tip']
+        return [t.strip() for t in output.splitlines()]
     
     
     @property
     def current_tags(self):
+        '''A list of the tags for the current parent of the working directory.
+        '''
         command = self.command + ['parents', '--template', '{tags}']
         proc = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE)
         
         self.sources = sources['static']
     
     def clone(self):
+        '''Create the repository directory if it does not exist.
+        '''
         if not os.path.isdir(self.path):
             os.mkdir(self.path)
     
     def pull(self):
+        '''Do nothing (this is a static repo, we don't pull until necessary).
+        '''
         pass
     
     def update(self, version):
+        '''Download and decompress the specified version if necessary.
+        '''
         path = os.path.join(self.path, version)
         temp_path = os.path.join(self.path, 'tmp')
         
     
     @property
     def tags(self):
+        '''A list of the available versions.
+        '''
         return self.sources.keys()
     
     
     @property
     def current_tags(self):
+        '''Do nothing.
+        
+        Static repos do not have a "current version" -- this concept is left
+        to the Shelf to implement.
+        '''
         return None
     
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.