Changeset 4a84d4eacaf7…
Parent 172429622081…
by Kevin Gessner <kevin@fogcreek.com>
Changes to 2 files · Browse files at 4a84d4eacaf7 Showing diff from parent 172429622081 Diff from another changeset...
@@ -5,8 +5,14 @@ import copy
import re
+try:
+ from mercurial.httprepo import httprepository
+except ImportError:
+ from mercurial.httppeer import httppeer
+ httprepository = httppeer
+
from mercurial import hg, extensions, commands, util, context, cmdutil
-from mercurial import match as match_, filemerge, node, archival, httprepo
+from mercurial import match as match_, filemerge, node, archival
from mercurial import error, manifest, merge
from mercurial.i18n import _
from mercurial.node import hex
@@ -27,7 +33,7 @@ # add a kbfiles-specific querystring argument to remote requests, so kiln
# can reject operations on a kbfiles-enabled remote repo from a non-kbfiles
# local repo.
- if issubclass(repo.__class__, httprepo.httprepository):
+ if issubclass(repo.__class__, httprepository):
class kbfilesrepo(repo.__class__):
# The function we want to override is do_cmd for Mercurial <= 1.6
# and _callstream for Mercurial > 1.6. Wrap whichever one we can
|
@@ -1,4 +1,4 @@ - # Copyright (C) 2011 Fog Creek Software. All rights reserved.
+# Copyright (C) 2011, 2012 Fog Creek Software. All rights reserved.
#
# To enable the "kiln" extension put these lines in your ~/.hgrc:
# [extensions]
@@ -10,7 +10,7 @@#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -51,8 +51,8 @@
from cookielib import MozillaCookieJar
from hashlib import md5
-from mercurial import commands, cmdutil, demandimport, extensions, hg, \
- httprepo, localrepo, match, util
+from mercurial import (commands, cmdutil, demandimport, extensions, hg,
+ localrepo, match, util)
from mercurial import ui as hgui
from mercurial import url as hgurl
from mercurial.error import RepoError
@@ -153,13 +153,16 @@ return url
def _baseurl(ui, path):
- remote = hg.repository(ui, path)
try:
- # Mercurial >= 1.9
- url = util.removeauth(remote.url())
- except AttributeError:
- # Mercurial <= 1.8
- url = hgurl.removeauth(remote.url())
+ url = str(util.url(util.removeauth(path)))
+ except util.Abort:
+ remote = hg.repository(ui, path)
+ try:
+ # Mercurial >= 1.9
+ url = util.removeauth(remote.url())
+ except AttributeError:
+ # Mercurial <= 1.8
+ url = hgurl.removeauth(remote.url())
if url.lower().find('/kiln/') > 0 or url.lower().find('kilnhg.com/') > 0:
return url
else:
@@ -894,7 +897,13 @@ push_cmd[1].extend([('', 'review', None, 'associate changesets with Kiln review')])
def reposetup(ui, repo):
- if issubclass(repo.__class__, httprepo.httprepository):
+ try:
+ from mercurial.httprepo import httprepository
+ httprepo = httprepository
+ except ImportError:
+ from mercurial.httppeer import httppeer
+ httprepo = httppeer
+ if issubclass(repo.__class__, httprepo):
_upgradecheck(ui, repo)
repo.ui.setconfig('hooks', 'outgoing.kilnreview', 'python:kiln.record_base')
|
Loading...