Repository: buildbot/buildbot

Issue:
Added Bitbucket build status reporter and documentation
Bitbucket's build status API is introduced here: 
https://blog.bitbucket.org/2015/11/18/introducing-the-build-status-api-for-bitbucket-cloud/

It seems quite different with respect to the URLs for the Stash build status API, and also used OAuth, so I made this reporter instead. Since I do not use stash

The docs page has been updated to show how to create and OAuth key for this reporter.

For testing I used a test Bitbucket repo here
https://bitbucket.org/scottbragg_aq1/testbb/commits/all



Discussion:

Resolving patch:
diff --git a/master/buildbot/clients/tryclient.py b/master/buildbot/clients/tryclient.py
--- a/master/buildbot/clients/tryclient.py
+++ b/master/buildbot/clients/tryclient.py
@@ -179,7 +179,7 @@ class MercurialExtractor(SourceStampExtractor):
     vcexe = "hg"
 
     def getBaseRevision(self):
-        d = self.dovc(["identify", "--id", "--debug"])
+        d = self.dovc(["parents", "--template", "{node}\\n"])
         d.addCallback(self.parseStatus)
         return d
 
diff --git a/master/buildbot/steps/source/mercurial.py b/master/buildbot/steps/source/mercurial.py
--- a/master/buildbot/steps/source/mercurial.py
+++ b/master/buildbot/steps/source/mercurial.py
@@ -180,7 +180,7 @@ def _gotResults(results):
         return d
 
     def parseGotRevision(self, _):
-        d = self._dovccmd(['identify', '--id', '--debug'], collectStdout=True)
+        d = self._dovccmd(['parents', '--template', '{node}\\n'], collectStdout=True)
         def _setrev(stdout):
             revision = stdout.strip()
             if len(revision) != 40:
diff --git a/slave/buildslave/commands/hg.py b/slave/buildslave/commands/hg.py
--- a/slave/buildslave/commands/hg.py
+++ b/slave/buildslave/commands/hg.py
@@ -269,8 +269,8 @@ def _update2(self, res):
 
     def parseGotRevision(self):
         hg = self.getCommand('hg')
-        # we use 'hg identify' to find out what we wound up with
-        command = [hg, "identify", "--id", "--debug"] # get full rev id
+        # we use 'hg parents' to find out what we wound up with
+        command = [hg, "parents", "--template", "{node}\\n"] # get full rev id
         c = runprocess.RunProcess(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
                          environ=self.env, timeout=self.timeout,


Test patch:
diff --git a/master/buildbot/test/unit/test_steps_source_mercurial.py b/master/buildbot/test/unit/test_steps_source_mercurial.py
--- a/master/buildbot/test/unit/test_steps_source_mercurial.py
+++ b/master/buildbot/test/unit/test_steps_source_mercurial.py
@@ -76,8 +76,8 @@ def test_mode_full_clean(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -122,8 +122,8 @@ def test_mode_full_clean_timeout(self):
             + 0,
             ExpectShell(workdir='wkdir',
                         timeout=1,
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -148,8 +148,8 @@ def test_mode_full_clean_no_existing_repo(self):
                                     'http://hg.mozilla.org', '.'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -178,8 +178,8 @@ def test_mode_full_clobber(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
             + 0,
@@ -216,8 +216,8 @@ def test_mode_full_fresh(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -242,8 +242,8 @@ def test_mode_full_fresh_no_existing_repo(self):
                                     'http://hg.mozilla.org', '.'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -272,8 +272,8 @@ def test_mode_incremental_no_existing_repo_dirname(self):
                         command=['hg', '--verbose', 'update', '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio', 
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -312,8 +312,8 @@ def test_mode_incremental_branch_change_dirname(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio', 
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -345,8 +345,8 @@ def test_mode_incremental_no_existing_repo_inrepo(self):
                         command=['hg', '--verbose', 'update', '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -378,8 +378,8 @@ def test_mode_incremental_existing_repo(self):
                         command=['hg', '--verbose', 'update', '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -415,8 +415,8 @@ def test_mode_incremental_given_revision(self):
                                  '--rev', 'abcdef01'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -458,8 +458,8 @@ def test_mode_incremental_branch_change(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -495,8 +495,8 @@ def test_mode_incremental_branch_change_no_clobberOnBranchChange(self):
                                  '--clean'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'])
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'])
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -536,8 +536,8 @@ def test_mode_full_clean_env(self):
                                  '--clean'], env={'abc': '123'})
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'], env={'abc': '123'})
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'], env={'abc': '123'})
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
                 stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d')
@@ -582,8 +582,8 @@ def test_mode_full_clean_logEnviron(self):
                         logEnviron=False)
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['hg', '--verbose', 'identify',
-                                    '--id', '--debug'],
+                        command=['hg', '--verbose', 'parents',
+                                    '--template', '{node}\\n'],
                         logEnviron=False)
             + ExpectShell.log('stdio', stdout='\n')
             + ExpectShell.log('stdio',
diff --git a/slave/buildslave/test/unit/test_commands_hg.py b/slave/buildslave/test/unit/test_commands_hg.py
--- a/slave/buildslave/test/unit/test_commands_hg.py
+++ b/slave/buildslave/test/unit/test_commands_hg.py
@@ -70,7 +70,7 @@ def test_simple(self):
                 self.basedir,
                 sendRC=False, timeout=120, usePTY=False)
                 + 0,
-            Expect(['path/to/hg', 'identify', '--id', '--debug'],
+            Expect(['path/to/hg', 'parents', '--template', '{node}\\n'],
                 self.basedir_source,
                 sendRC=False, timeout=120, usePTY=False, environ=exp_environ,
                 keepStdout=True)
@@ -122,7 +122,7 @@ def test_update_existing(self):
                 self.basedir,
                 sendRC=False, timeout=120, usePTY=False)
                 + 0,
-            Expect(['path/to/hg', 'identify', '--id', '--debug'],
+            Expect(['path/to/hg', 'parents', '--template', '{node}\\n'],
                 self.basedir_workdir,
                 sendRC=False, timeout=120, usePTY=False, environ=exp_environ,
                 keepStdout=True)
@@ -177,7 +177,7 @@ def test_update_existing_change_branch(self):
                 self.basedir,
                 sendRC=False, timeout=120, usePTY=False)
                 + 0,
-            Expect(['path/to/hg', 'identify', '--id', '--debug'],
+            Expect(['path/to/hg', 'parents', '--template', '{node}\\n'],
                 self.basedir_workdir,
                 sendRC=False, timeout=120, usePTY=False, environ=exp_environ,
                 keepStdout=True)
@@ -234,7 +234,7 @@ def test_update_handle_emptyupdate(self):
                 self.basedir,
                 sendRC=False, timeout=120, usePTY=False)
                 + 0,
-            Expect(['path/to/hg', 'identify', '--id', '--debug'],
+            Expect(['path/to/hg', 'parents', '--template', '{node}\\n'],
                 self.basedir_workdir,
                 sendRC=False, timeout=120, usePTY=False, environ=exp_environ,
                 keepStdout=True)
@@ -313,7 +313,7 @@ def test_update_existing_change_branch_purge_fail(self):
                 self.basedir,
                 sendRC=False, timeout=120, usePTY=False)
                 + 0,
-            Expect(['path/to/hg', 'identify', '--id', '--debug'],
+            Expect(['path/to/hg', 'parents', '--template', '{node}\\n'],
                 self.basedir_workdir,
                 sendRC=False, timeout=120, usePTY=False, environ=exp_environ,
                 keepStdout=True)