Commits

Steve Losh committed 638db9b

guts: Add tags to the Mercurial repo and use it in info.

Comments (0)

Files changed (3)

lib/gorilla/guts/cli.py

             
             ui.write('\ndownloaded: %s\n' % download_status)
             ui.write('installed:  %s\n\n' % installed_status)
+            
+            shelf = Shelf(card)
+            if shelf.present:
+                ui.write('available versions: %s\n' % ', '.join(shelf.versions))
     else:
         ui.write('gorilla knows about %d packages\n' % len(list(all_cards())))
 

lib/gorilla/guts/repo.py

         rc = subprocess.call(command, shell=False)
         return rc == 0
     
+    @property
+    def tags(self):
+        command = ['hg', 'tags', '-R', self.path, '--quiet']
+        proc = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE)
+        
+        output = proc.communicate()[0]
+        return output.splitlines()
+    

lib/gorilla/guts/shelf.py

         return packages_installed and scripts_installed
     
     
+    @property
+    def versions(self):
+        return [t.strip() for t in self.repo.tags]
+    
     def grab(self):
         """Download the latest version of the package (clone if necessary).