Patchwork [2,of,2,V2] blackbox: fix blackbox causing exceptions in tests

login
register
mail settings
Submitter Durham Goode
Date May 23, 2013, 1:53 a.m.
Message ID <88afc49be6cfab7e4218.1369273997@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1664/
State Accepted
Commit 6d6f148cada9677f0737517a071eebdf769b8f4b
Headers show

Comments

Durham Goode - May 23, 2013, 1:53 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1369269504 25200
#      Wed May 22 17:38:24 2013 -0700
# Node ID 88afc49be6cfab7e42180ae82d0a17aa662c24d4
# Parent  5a27f1294beaf297888aed7dc0f2247bdb4032e8
blackbox: fix blackbox causing exceptions in tests

In the tests some scripts call reposetup with the base ui instead of the
one the extensions have modified.  This causes an exception in
blackbox.reposetup since it expected a method to be there. So I just
check for it first. This only happened when the blackbox extension
was enabled during tests.
Matt Mackall - May 23, 2013, 9:51 p.m.
On Wed, 2013-05-22 at 18:53 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1369269504 25200
> #      Wed May 22 17:38:24 2013 -0700
> # Node ID 88afc49be6cfab7e42180ae82d0a17aa662c24d4
> # Parent  5a27f1294beaf297888aed7dc0f2247bdb4032e8
> blackbox: fix blackbox causing exceptions in tests

These are queued for stable, thanks.

Patch

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -126,7 +126,8 @@ 
     if not repo.local():
         return
 
-    ui.setrepo(repo)
+    if util.safehasattr(ui, 'setrepo'):
+        ui.setrepo(repo)
 
 @command('^blackbox',
     [('l', 'limit', 10, _('the number of events to show')),