Mercurial > hg
annotate hgext/hgcia.py @ 20742:3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
This change causes an informative ImportError to be raised when importing
the parsers extension module if the minor version of the currently-running
Python interpreter doesn't match that of the Python used when compiling
the extension module.
This change also exposes a parsers.versionerrortext constant in the
C implementation of the module. Its presence can be used to determine
whether this behavior is present in a version of the module. The value
of the constant is the leading text of the ImportError raised and is set
to "Python minor version mismatch".
Here is an example of what the new error looks like:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import mercurial.parsers
ImportError: Python minor version mismatch: The Mercurial extension
modules were compiled with Python 2.7.6, but Mercurial is currently using
Python with sys.hexversion=33883888: Python 2.5.6
(r256:88840, Nov 18 2012, 05:37:10)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))]
at: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python
The reason for raising an error in this scenario is that Python's C API
is known not to be compatible from minor version to minor version, even
if sys.api_version is the same. See for example this Python bug report
about incompatibilities between 2.5 and 2.6+:
http://bugs.python.org/issue8118
These incompatibilities can cause Mercurial to break in mysterious,
unforeseen ways. For example, when Mercurial compiled with Python 2.7 was
run with 2.5, the following crash occurred when running "hg status":
http://bz.selenic.com/show_bug.cgi?id=4110
After this crash was fixed, running with Python 2.5 no longer crashes, but
the following puzzling behavior still occurs:
$ hg status
...
File ".../mercurial/changelog.py", line 123, in __init__
revlog.revlog.__init__(self, opener, "00changelog.i")
File ".../mercurial/revlog.py", line 251, in __init__
d = self._io.parseindex(i, self._inline)
File ".../mercurial/revlog.py", line 158, in parseindex
index, cache = parsers.parse_index2(data, inline)
TypeError: data is not a string
which can be reproduced more simply with:
import mercurial.parsers as parsers
parsers.parse_index2("", True)
Both the crash and the TypeError occurred because the Python C API's
PyString_Check() returns the wrong value when the C header files from
Python 2.7 are run with Python 2.5. This is an example of an
incompatibility of the sort mentioned in the Python bug report above.
Failing fast with an informative error message results in a better user
experience in cases like the above. The information in the ImportError
also simplifies troubleshooting for those on Mercurial mailing lists, the
bug tracker, etc.
This patch only adds the version check to parsers.c, which is sufficient
to affect command-line commands like "hg status" and "hg summary".
An idea for a future improvement is to move the version-checking C code
to a more central location, and have it run when importing all
Mercurial extension modules and not just parsers.c.
author | Chris Jerdonek <chris.jerdonek@gmail.com> |
---|---|
date | Wed, 04 Dec 2013 20:38:27 -0800 |
parents | e96e9f805c19 |
children | 1c38b4063586 |
rev | line source |
---|---|
7438 | 1 # Copyright (C) 2007-8 Brendan Cully <brendan@kublai.com> |
10263 | 2 # |
3 # This software may be used and distributed according to the terms of the | |
4 # GNU General Public License version 2 or any later version. | |
7438 | 5 |
8935
f4f0e902b750
extensions: change descriptions for hook-providing extensions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8894
diff
changeset
|
6 """hooks for integrating with the CIA.vc notification service |
7438 | 7 |
9260
b2f37dbc5952
hgcia: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9208
diff
changeset
|
8 This is meant to be run as a changegroup or incoming hook. To |
b2f37dbc5952
hgcia: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9208
diff
changeset
|
9 configure it, set the following options in your hgrc:: |
7438 | 10 |
9208
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
11 [cia] |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
12 # your registered CIA user name |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
13 user = foo |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
14 # the name of the project in CIA |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
15 project = foo |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
16 # the module (subproject) (optional) |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
17 #module = foo |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
18 # Append a diffstat to the log message (optional) |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
19 #diffstat = False |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
20 # Template to use for log messages (optional) |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
21 #template = {desc}\\n{baseurl}{webroot}/rev/{node}-- {diffstat} |
9208
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
22 # Style to use (optional) |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
23 #style = foo |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
24 # The URL of the CIA notification service (optional) |
17424
e7cfe3587ea4
fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents:
16743
diff
changeset
|
25 # You can use mailto: URLs to send by email, e.g. |
9208
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
26 # mailto:cia@cia.vc |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
27 # Make sure to set email.from if you do this. |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
28 #url = http://cia.vc/ |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
29 # print message instead of sending it (optional) |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
30 #test = False |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
31 # number of slashes to strip for url paths |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
32 #strip = 0 |
7438 | 33 |
9208
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
34 [hooks] |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
35 # one of these: |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
36 changegroup.cia = python:hgcia.hook |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
37 #incoming.cia = python:hgcia.hook |
7438 | 38 |
9208
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
39 [web] |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
40 # If you want hyperlinks (optional) |
12d119ae39bc
hgcia: use reST syntax for literal block
Martin Geisler <mg@lazybytes.net>
parents:
9136
diff
changeset
|
41 baseurl = http://server/path/to/repo |
7438 | 42 """ |
43 | |
44 from mercurial.i18n import _ | |
11750
26e413f55b5e
hgcia/color: remove star imports
Brodie Rao <brodie@bitheap.org>
parents:
10611
diff
changeset
|
45 from mercurial.node import bin, short |
7438 | 46 from mercurial import cmdutil, patch, templater, util, mail |
47 import email.Parser | |
48 | |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
15776
diff
changeset
|
49 import socket, xmlrpclib |
7438 | 50 from xml.sax import saxutils |
16743
38caf405d010
hgext: mark all first-party extensions as such
Augie Fackler <raf@durin42.com>
parents:
16688
diff
changeset
|
51 testedwith = 'internal' |
7438 | 52 |
53 socket_timeout = 30 # seconds | |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
15776
diff
changeset
|
54 if util.safehasattr(socket, 'setdefaulttimeout'): |
7438 | 55 # set a timeout for the socket so you don't have to wait so looooong |
56 # when cia.vc is having problems. requires python >= 2.3: | |
57 socket.setdefaulttimeout(socket_timeout) | |
58 | |
59 HGCIA_VERSION = '0.1' | |
60 HGCIA_URL = 'http://hg.kublai.com/mercurial/hgcia' | |
61 | |
62 | |
63 class ciamsg(object): | |
64 """ A CIA message """ | |
65 def __init__(self, cia, ctx): | |
66 self.cia = cia | |
67 self.ctx = ctx | |
68 self.url = self.cia.url | |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
69 if self.url: |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
70 self.url += self.cia.root |
7438 | 71 |
72 def fileelem(self, path, uri, action): | |
73 if uri: | |
74 uri = ' uri=%s' % saxutils.quoteattr(uri) | |
75 return '<file%s action=%s>%s</file>' % ( | |
76 uri, saxutils.quoteattr(action), saxutils.escape(path)) | |
77 | |
78 def fileelems(self): | |
79 n = self.ctx.node() | |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13551
diff
changeset
|
80 f = self.cia.repo.status(self.ctx.p1().node(), n) |
7438 | 81 url = self.url or '' |
14850
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
82 if url and url[-1] == '/': |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
83 url = url[:-1] |
7438 | 84 elems = [] |
85 for path in f[0]: | |
86 uri = '%s/diff/%s/%s' % (url, short(n), path) | |
87 elems.append(self.fileelem(path, url and uri, 'modify')) | |
88 for path in f[1]: | |
89 # TODO: copy/rename ? | |
90 uri = '%s/file/%s/%s' % (url, short(n), path) | |
91 elems.append(self.fileelem(path, url and uri, 'add')) | |
92 for path in f[2]: | |
93 elems.append(self.fileelem(path, '', 'remove')) | |
94 | |
95 return '\n'.join(elems) | |
96 | |
97 def sourceelem(self, project, module=None, branch=None): | |
98 msg = ['<source>', '<project>%s</project>' % saxutils.escape(project)] | |
99 if module: | |
100 msg.append('<module>%s</module>' % saxutils.escape(module)) | |
101 if branch: | |
102 msg.append('<branch>%s</branch>' % saxutils.escape(branch)) | |
103 msg.append('</source>') | |
104 | |
105 return '\n'.join(msg) | |
106 | |
107 def diffstat(self): | |
8778
c5f36402daad
use new style classes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8541
diff
changeset
|
108 class patchbuf(object): |
7438 | 109 def __init__(self): |
110 self.lines = [] | |
111 # diffstat is stupid | |
112 self.name = 'cia' | |
113 def write(self, data): | |
15776
55a85a55f020
hgcia: fix diffstat support
Matt Mackall <mpm@selenic.com>
parents:
14850
diff
changeset
|
114 self.lines += data.splitlines(True) |
7438 | 115 def close(self): |
116 pass | |
117 | |
118 n = self.ctx.node() | |
119 pbuf = patchbuf() | |
10611
e764f24a45ee
patch/diff: move patch.export() to cmdutil.export()
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10529
diff
changeset
|
120 cmdutil.export(self.cia.repo, [n], fp=pbuf) |
7438 | 121 return patch.diffstat(pbuf.lines) or '' |
122 | |
123 def logmsg(self): | |
124 diffstat = self.cia.diffstat and self.diffstat() or '' | |
125 self.cia.ui.pushbuffer() | |
126 self.cia.templater.show(self.ctx, changes=self.ctx.changeset(), | |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
127 baseurl=self.cia.ui.config('web', 'baseurl'), |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
128 url=self.url, diffstat=diffstat, |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
129 webroot=self.cia.root) |
7438 | 130 return self.cia.ui.popbuffer() |
131 | |
132 def xml(self): | |
133 n = short(self.ctx.node()) | |
134 src = self.sourceelem(self.cia.project, module=self.cia.module, | |
135 branch=self.ctx.branch()) | |
136 # unix timestamp | |
137 dt = self.ctx.date() | |
138 timestamp = dt[0] | |
139 | |
140 author = saxutils.escape(self.ctx.user()) | |
141 rev = '%d:%s' % (self.ctx.rev(), n) | |
142 log = saxutils.escape(self.logmsg()) | |
143 | |
14850
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
144 url = self.url |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
145 if url and url[-1] == '/': |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
146 url = url[:-1] |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
147 url = url and '<url>%s/rev/%s</url>' % (saxutils.escape(url), n) or '' |
7438 | 148 |
149 msg = """ | |
150 <message> | |
151 <generator> | |
152 <name>Mercurial (hgcia)</name> | |
153 <version>%s</version> | |
154 <url>%s</url> | |
155 <user>%s</user> | |
156 </generator> | |
157 %s | |
158 <body> | |
159 <commit> | |
160 <author>%s</author> | |
161 <version>%s</version> | |
162 <log>%s</log> | |
163 %s | |
164 <files>%s</files> | |
165 </commit> | |
166 </body> | |
167 <timestamp>%d</timestamp> | |
168 </message> | |
169 """ % \ | |
170 (HGCIA_VERSION, saxutils.escape(HGCIA_URL), | |
171 saxutils.escape(self.cia.user), src, author, rev, log, url, | |
172 self.fileelems(), timestamp) | |
173 | |
174 return msg | |
175 | |
176 | |
177 class hgcia(object): | |
178 """ CIA notification class """ | |
179 | |
180 deftemplate = '{desc}' | |
181 dstemplate = '{desc}\n-- \n{diffstat}' | |
182 | |
183 def __init__(self, ui, repo): | |
184 self.ui = ui | |
185 self.repo = repo | |
186 | |
187 self.ciaurl = self.ui.config('cia', 'url', 'http://cia.vc') | |
188 self.user = self.ui.config('cia', 'user') | |
189 self.project = self.ui.config('cia', 'project') | |
190 self.module = self.ui.config('cia', 'module') | |
191 self.diffstat = self.ui.configbool('cia', 'diffstat') | |
192 self.emailfrom = self.ui.config('email', 'from') | |
193 self.dryrun = self.ui.configbool('cia', 'test') | |
194 self.url = self.ui.config('web', 'baseurl') | |
14850
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
195 # Default to -1 for backward compatibility |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
196 self.stripcount = int(self.ui.config('cia', 'strip', -1)) |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
197 self.root = self.strip(self.repo.root) |
7438 | 198 |
199 style = self.ui.config('cia', 'style') | |
200 template = self.ui.config('cia', 'template') | |
201 if not template: | |
202 template = self.diffstat and self.dstemplate or self.deftemplate | |
203 template = templater.parsestring(template, quoted=False) | |
7762
fece056bf240
add --git option to commands supporting --patch (log, incoming, history, tip)
Jim Correia <jim.correia@pobox.com>
parents:
7438
diff
changeset
|
204 t = cmdutil.changeset_templater(self.ui, self.repo, False, None, |
20667
e96e9f805c19
changeset_templater: remove use_template method
Matt Mackall <mpm@selenic.com>
parents:
17424
diff
changeset
|
205 template, style, False) |
7438 | 206 self.templater = t |
207 | |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
208 def strip(self, path): |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
209 '''strip leading slashes from local path, turn into web-safe path.''' |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
210 |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
211 path = util.pconvert(path) |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
212 count = self.stripcount |
14850
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
213 if count < 0: |
a95242af945c
hgcia: Set default value of strip to -1 (issue2891)
Cédric Krier <ced@b2ck.com>
parents:
14314
diff
changeset
|
214 return '' |
14314
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
215 while count > 0: |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
216 c = path.find('/') |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
217 if c == -1: |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
218 break |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
219 path = path[c + 1:] |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
220 count -= 1 |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
221 return path |
c322890b03e6
hgcia: Handle URL like in notify (issue2406)
Cédric Krier <ced@b2ck.com>
parents:
13878
diff
changeset
|
222 |
7438 | 223 def sendrpc(self, msg): |
224 srv = xmlrpclib.Server(self.ciaurl) | |
10529
076e8a8000a3
hgcia: report RPC errors
Brendan Cully <brendan@kublai.com>
parents:
10263
diff
changeset
|
225 res = srv.hub.deliver(msg) |
13551
bbfae32f178e
hgcia: accept "queued." xmlrpc return as success
Georg Brandl <georg@python.org>
parents:
11750
diff
changeset
|
226 if res is not True and res != 'queued.': |
10529
076e8a8000a3
hgcia: report RPC errors
Brendan Cully <brendan@kublai.com>
parents:
10263
diff
changeset
|
227 raise util.Abort(_('%s returned an error: %s') % |
076e8a8000a3
hgcia: report RPC errors
Brendan Cully <brendan@kublai.com>
parents:
10263
diff
changeset
|
228 (self.ciaurl, res)) |
7438 | 229 |
230 def sendemail(self, address, data): | |
231 p = email.Parser.Parser() | |
232 msg = p.parsestr(data) | |
233 msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") | |
234 msg['To'] = address | |
235 msg['From'] = self.emailfrom | |
236 msg['Subject'] = 'DeliverXML' | |
237 msg['Content-type'] = 'text/xml' | |
9136
31177742f54a
for calls expecting bool args, pass bool instead of int
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
9062
diff
changeset
|
238 msgtext = msg.as_string() |
7438 | 239 |
240 self.ui.status(_('hgcia: sending update to %s\n') % address) | |
241 mail.sendmail(self.ui, util.email(self.emailfrom), | |
242 [address], msgtext) | |
243 | |
244 | |
245 def hook(ui, repo, hooktype, node=None, url=None, **kwargs): | |
246 """ send CIA notification """ | |
247 def sendmsg(cia, ctx): | |
248 msg = ciamsg(cia, ctx).xml() | |
249 if cia.dryrun: | |
250 ui.write(msg) | |
251 elif cia.ciaurl.startswith('mailto:'): | |
252 if not cia.emailfrom: | |
253 raise util.Abort(_('email.from must be defined when ' | |
254 'sending by email')) | |
255 cia.sendemail(cia.ciaurl[7:], msg) | |
256 else: | |
257 cia.sendrpc(msg) | |
258 | |
259 n = bin(node) | |
260 cia = hgcia(ui, repo) | |
261 if not cia.user: | |
9467
4c041f1ee1b4
do not attempt to translate ui.debug output
Martin Geisler <mg@lazybytes.net>
parents:
9260
diff
changeset
|
262 ui.debug('cia: no user specified') |
7438 | 263 return |
264 if not cia.project: | |
9467
4c041f1ee1b4
do not attempt to translate ui.debug output
Martin Geisler <mg@lazybytes.net>
parents:
9260
diff
changeset
|
265 ui.debug('cia: no project specified') |
7438 | 266 return |
267 if hooktype == 'changegroup': | |
268 start = repo.changelog.rev(n) | |
269 end = len(repo.changelog) | |
270 for rev in xrange(start, end): | |
271 n = repo.changelog.node(rev) | |
272 ctx = repo.changectx(n) | |
273 sendmsg(cia, ctx) | |
274 else: | |
275 ctx = repo.changectx(n) | |
276 sendmsg(cia, ctx) |