changeset 182:13293c35f162

more cargo culting
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 01 Feb 2011 12:22:39 -0800
parents 941ea8544756
children 225f88b6b1d6
files autobot/changes/poller.py
diffstat 1 files changed, 36 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/changes/poller.py	Tue Feb 01 11:45:05 2011 -0800
+++ b/autobot/changes/poller.py	Tue Feb 01 12:22:39 2011 -0800
@@ -400,6 +400,20 @@
         """is the repository initialized?"""
         return os.path.exists(os.path.join(self.workdir, '.git'))
 
+    def checkoutBranch(self, _):
+        """checkout the branch"""
+        # XXX I have no clue why I am doing this except that I'm working
+        # around twisted evidently not doing what I think its doing
+        # so in the face of a clearly superior architecture I will
+        # randomly stab around and hope to god that eventually,
+        # through sheer dumb luck, I can get on the proper branch
+        d = utils.getProcessOutput(self.binary, ['checkout', self.branch],
+                                   path=self.workdir,
+                                   env=dict(PATH=os.environ['PATH']),
+                                   errortoo=True)
+        return d
+
+
     def initializationCommands(self):
         """commands needed to initialize the repository"""
         
@@ -409,12 +423,23 @@
             commands.append(['--git-dir', git_dir, 'checkout', self.branch])
         return commands
 
-    def _fetch(self, _):
+    def update(self, _):
         args = ['pull', 'origin', self.branch]
         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
                                    env=dict(PATH=os.environ['PATH']),
                                    errortoo=True)
         return d
+        
+
+    def _fetch(self, _):
+        d = self.checkoutBranch(None)
+        d.addCallback(self.update)
+        return d
+#         args = ['pull', 'origin', self.branch]
+#         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
+#                                    env=dict(PATH=os.environ['PATH']),
+#                                    errortoo=True)
+#         return d
 
     def _hash(self, _):
         """
@@ -424,15 +449,16 @@
         git rev-parse HEAD
         """
         
-        d = utils.getProcessOutput(self.binary, ['show-ref', 'HEAD', '--hash', self.branch],
+        d = utils.getProcessOutput(self.binary, ['rev-parse', 'HEAD'],
                                    path=self.workdir,
-                                   env=dict(PATH=os.environ['PATH']), errortoo=False )
-#         d = utils.getProcessOutput(self.binary, ['rev-parse', 'HEAD'],
-#                                    path=self.workdir,
-#                                    env=dict(PATH=os.environ['PATH']), errortoo=False )
+                                   env=dict(PATH=os.environ['PATH']), errortoo=False)
 
 
         return d
+    #        d = utils.getProcessOutput(self.binary, ['show-ref', 'HEAD', '--hash', self.branch],
+#                                   path=self.workdir,
+#                                   env=dict(PATH=os.environ['PATH']), errortoo=False )
+
 
     def _change_list(self, _):
         range = '%s..%s' % (self.preHash, self.postHash)
@@ -468,7 +494,7 @@
 
     ### timestamp
 
-    def _get_commit_timestamp(self, rev):
+    def _get_commit_timestamp(self, _, rev):
         # unix timestamp
         args = ['log', rev, '--no-walk', r'--format=%ct']
         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
@@ -492,7 +518,7 @@
 
     ### commit author ('name')
 
-    def _get_commit_name(self, rev):
+    def _get_commit_name(self, _, rev):
         args = ['log', rev, '--no-walk', r'--format=%aE']
         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
                                    env=dict(PATH=os.environ['PATH']),
@@ -509,7 +535,7 @@
 
     ### files
 
-    def _get_commit_files(self, rev):
+    def _get_commit_files(self, _, rev):
         args = ['log', rev, '--name-only', '--no-walk', r'--format=%n']
         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
                                    env=dict(PATH=os.environ['PATH']),
@@ -525,7 +551,7 @@
 
     ### comments
 
-    def _get_commit_comments(self, rev):
+    def _get_commit_comments(self, _, rev):
         args = ['log', rev, '--no-walk', r'--format=%s%n%b']
         d = utils.getProcessOutput(self.binary, args, path=self.workdir,
                                    env=dict(PATH=os.environ['PATH']),