Kiln » Kiln Extensions
Clone URL:  
Pushed to 2 repositories · View In Graph Contained in tip

Update extensions to support Mercurial 2.3

Changeset 4a84d4eacaf7

Parent 172429622081

by Profile picture of User 276Kevin Gessner <kevin@fogcreek.com>

Changes to 2 files · Browse files at 4a84d4eacaf7 Showing diff from parent 172429622081 Diff from another changeset...

 
5
6
7
 
 
 
 
 
 
8
9
 
10
11
12
 
27
28
29
30
 
31
32
33
 
5
6
7
8
9
10
11
12
13
14
 
15
16
17
18
 
33
34
35
 
36
37
38
39
@@ -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
Change 1 of 5 Show Entire File kiln.py Stacked
 
1
 
2
3
4
 
10
11
12
13
 
14
15
16
 
51
52
53
54
55
 
 
56
57
58
 
153
154
155
156
157
158
159
160
161
162
 
 
 
 
 
 
 
 
 
163
164
165
 
894
895
896
897
 
 
 
 
 
 
 
898
899
900
 
 
1
2
3
4
 
10
11
12
 
13
14
15
16
 
51
52
53
 
 
54
55
56
57
58
 
153
154
155
 
156
 
 
 
 
 
157
158
159
160
161
162
163
164
165
166
167
168
 
897
898
899
 
900
901
902
903
904
905
906
907
908
909
@@ -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')