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

upgrade extensions to Kiln 2.5.139

Changeset bf74641d43fb

Parent 03426ac40250

by Profile picture of User 12Benjamin Pollack <benjamin@fogcreek.com>

Changes to 6 files · Browse files at bf74641d43fb Showing diff from parent 03426ac40250 Diff from another changeset...

Change 1 of 1 Show Changes Only big-push.py Stacked
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
-# Copyright (C) 2009-2010 Fog Creek Software. All rights reserved. +# Copyright (C) 2009-2011 Fog Creek Software. All rights reserved.  #  # 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  # (at your option) any later version.  #  # This program is distributed in the hope that it will be useful,  # but WITHOUT ANY WARRANTY; without even the implied warranty of  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  #  # You should have received a copy of the GNU General Public License  # along with this program; if not, write to the Free Software  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.    '''automatically push large repositories in chunks'''    from mercurial import cmdutil, commands, hg, extensions  from mercurial.i18n import _    try:   from mercurial import discovery  except ImportError:   pass    max_push_size = 1000    def findoutgoing(repo, other):   try:   # Mercurial 1.6 through 1.8   return discovery.findoutgoing(repo, other, force=False)   except AttributeError:   # Mercurial 1.9 and higher   common, _anyinc, _heads = discovery.findcommonincoming(repo, other, force=False)   return repo.changelog.findmissing(common)   except ImportError:   # Mercurial 1.5 and lower   return repo.findoutgoing(other, force=False)    def prepush(repo, other, force, revs):   try:   # Mercurial 1.6 and higher   from mercurial import discovery   return discovery.prepush(repo, other, force, revs, False)   except ImportError:   # Mercurial 1.5 and lower   return repo.prepush(other, False, revs)    def remoteui(repo, opts):   if hasattr(cmdutil, 'remoteui'):   # Mercurial 1.5 and lower   return cmdutil.remoteui(repo, opts)   else:   # Mercurial 1.6 and higher   return hg.remoteui(repo, opts)    def bigpush(push_fn, ui, repo, dest=None, *files, **opts):   '''Pushes this repository to a target repository.     If this repository is small, behaves as the native push command.   For large, remote repositories, the repository is pushed in chunks   of size optimized for performance on the network.'''   if not opts.get('chunked'):   return push_fn(ui, repo, dest, **opts)     source, revs = parseurl(ui.expandpath(dest or 'default-push', dest or 'default'))   other = hg.repository(remoteui(repo, opts), source)   if hasattr(hg, 'addbranchrevs'):   revs = hg.addbranchrevs(repo, other, revs, opts.get('rev'))[0]   if revs:   revs = [repo.lookup(rev) for rev in revs]   if other.local():   return push_fn(ui, repo, dest, **opts)     ui.status(_('pushing to %s\n') % other.path)     outgoing = findoutgoing(repo, other)   if outgoing:   outgoing = repo.changelog.nodesbetween(outgoing, revs)[0]     # if the push will create multiple heads and isn't forced, fail now   # (prepush prints an error message, so we can just exit)   if not opts.get('force') and not opts.get('new_branch') and None == prepush(repo, other, False, revs)[0]:   return   try:   push_size = 1   while len(outgoing) > 0:   ui.debug('start: %d to push\n' % len(outgoing))   current_push_size = min(push_size, len(outgoing))   ui.debug('pushing: %d\n' % current_push_size)   # force the push, because we checked above that by the time the whole push is done, we'll have merged back to one head   remote_heads = repo.push(other, force=True, revs=outgoing[:current_push_size])   if remote_heads: # push succeeded   outgoing = outgoing[current_push_size:]   ui.debug('pushed %d ok\n' % current_push_size)   if push_size < max_push_size:   push_size *= 2   else: # push failed; try again with a smaller size   push_size /= 2   ui.debug('failed, trying %d\n' % current_push_size)   if push_size == 0:   raise UnpushableChangesetError   except UnpushableChangesetError:   ui.status(_('unable to push changeset %s\n') % outgoing[0])   ui.debug('done\n')    def parseurl(source):   '''wrap hg.parseurl to work on 1.3 -> 1.5'''   return hg.parseurl(source, None)[:2]    def uisetup(ui):   push_cmd = extensions.wrapcommand(commands.table, 'push', bigpush)   push_cmd[1].extend([('', 'chunked', None, 'push large repository in chunks')])    class UnpushableChangesetError(Exception):   pass
Change 1 of 2 Show Entire File caseguard.py Stacked
 
 
 
 
 
1
2
3
 
33
34
35
36
37
38
39
40
 
1
2
3
4
5
6
7
 
37
38
39
 
 
40
41
42
@@ -1,3 +1,7 @@
+# Portions copyright (C) 2011 Fog Creek Software. +# Portions copyright (C) 2010 Alexandru Totolici +# http://hackd.net/projects/caseguard/ +#  # This Mercurial extension prevents users from adding:  # * filenames that differ only by case (i.e. 'FOO' and 'foo')  # * Windows-reserved filenames. @@ -33,8 +37,6 @@
 # repository tracks. All changes must be committed before caseguard will  # allow files to be added (this means 'hg rm foo; hg add FOO' will fail).  # -# Copyright (C) 2010 - Alexandru Totolici -# http://hackd.net/projects/caseguard/  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2 or any later version.
Change 1 of 1 Show Entire File gestalt.py Stacked
 
1
 
2
3
4
 
 
1
2
3
4
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2010 Fog Creek Software. All rights reserved. +# Copyright (C) 2009-2011 Fog Creek Software. All rights reserved.  #  # To enable the "gestalt" extension put these lines in your ~/.hgrc:  # [extensions]
Change 1 of 1 Show Entire File kiln.py Stacked
 
143
144
145
146
 
147
148
149
 
143
144
145
 
146
147
148
149
@@ -143,7 +143,7 @@
  else:   fd = urllib2.urlopen(url + '?' + data)   obj = json.load(fd) - except: + except Exception:   raise util.Abort(_('Path guessing requires Fog Creek Kiln 2.0. If you'   ' are running Kiln 2.0 and continue to experience'   ' problems, please contact Fog Creek Software.'))
Change 1 of 4 Show Entire File kilnauth.py Stacked
 
1
 
2
3
4
 
31
32
33
 
 
34
 
 
35
36
37
38
39
40
41
42
 
76
77
78
 
 
79
80
81
82
83
 
 
 
 
 
 
 
84
85
86
 
109
110
111
112
 
113
114
 
115
116
117
 
 
1
2
3
4
 
31
32
33
34
35
36
37
38
39
 
 
 
 
40
41
42
 
76
77
78
79
80
81
 
 
 
 
82
83
84
85
86
87
88
89
90
91
 
114
115
116
 
117
118
 
119
120
121
122
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2010 Fog Creek Software. All rights reserved. +# Copyright (C) 2009-2011 Fog Creek Software. All rights reserved.  #  # To enable the "kilnauth" extension put these lines in your ~/.hgrc:  # [extensions] @@ -31,12 +31,12 @@
 If you ever need to logout of Kiln, simply run ``hg logout''  '''   +from cookielib import MozillaCookieJar, Cookie +from urllib2 import Request  import os +import re +import shutil  import stat -import re -from urllib2 import Request -from cookielib import MozillaCookieJar, Cookie -import shutil  import sys  import tempfile   @@ -76,11 +76,16 @@
  pass     def save(self, *args, **kwargs): + with open(self.__temporary_path, 'rb') as f: + before = md5(f.read()).digest()   super(CookieJar, self).save(*args, **kwargs) - try: - shutil.copyfile(self.__temporary_path, self.__original_path) - except IOError: - pass + with open(self.__temporary_path, 'rb') as f: + after = md5(f.read()).digest() + if before != after: + try: + os.rename(self.__temporary_path, self.__original_path) + except (IOError, WindowsError, OSError): + pass    def get_cookiejar(ui):   global current_user @@ -109,9 +114,9 @@
  os.chmod(cookie_path, stat.S_IREAD | stat.S_IWRITE)   cj.load(ignore_discard=True, ignore_expires=True)   return cj - except IOError, e: + except IOError:   ui.warn(_('Cookie file %s exists, but could not be opened.\nContinuing without cookie authentication.\n') % cookie_path) - return MozillaCookieJar() + return MozillaCookieJar(tempfile.NamedTemporaryFile().name)    def make_cookie(request, name, value):   domain = request.get_host()
Change 1 of 1 Show Entire File kilnpath.py Stacked
 
1
 
2
3
4
 
 
1
2
3
4
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2010 Fog Creek Software. All rights reserved. +# Copyright (C) 2009-2011 Fog Creek Software. All rights reserved.  #  # To enable the "kilnpath" extension put these lines in your ~/.hgrc:  # [extensions]