##// END OF EJS Templates
hgcia: Set default value of strip to -1 (issue2891)...
Cédric Krier -
r14850:a95242af stable
parent child Browse files
Show More
@@ -81,6 +81,8 b' class ciamsg(object):'
81 81 n = self.ctx.node()
82 82 f = self.cia.repo.status(self.ctx.p1().node(), n)
83 83 url = self.url or ''
84 if url and url[-1] == '/':
85 url = url[:-1]
84 86 elems = []
85 87 for path in f[0]:
86 88 uri = '%s/diff/%s/%s' % (url, short(n), path)
@@ -141,8 +143,10 b' class ciamsg(object):'
141 143 rev = '%d:%s' % (self.ctx.rev(), n)
142 144 log = saxutils.escape(self.logmsg())
143 145
144 url = self.url and '<url>%s/rev/%s</url>' % (saxutils.escape(self.url),
145 n) or ''
146 url = self.url
147 if url and url[-1] == '/':
148 url = url[:-1]
149 url = url and '<url>%s/rev/%s</url>' % (saxutils.escape(url), n) or ''
146 150
147 151 msg = """
148 152 <message>
@@ -190,7 +194,8 b' class hgcia(object):'
190 194 self.emailfrom = self.ui.config('email', 'from')
191 195 self.dryrun = self.ui.configbool('cia', 'test')
192 196 self.url = self.ui.config('web', 'baseurl')
193 self.stripcount = int(self.ui.config('cia', 'strip', 0))
197 # Default to -1 for backward compatibility
198 self.stripcount = int(self.ui.config('cia', 'strip', -1))
194 199 self.root = self.strip(self.repo.root)
195 200
196 201 style = self.ui.config('cia', 'style')
@@ -208,6 +213,8 b' class hgcia(object):'
208 213
209 214 path = util.pconvert(path)
210 215 count = self.stripcount
216 if count < 0:
217 return ''
211 218 while count > 0:
212 219 c = path.find('/')
213 220 if c == -1:
@@ -46,9 +46,47 b' Test the CIA extension'
46 46 <author>test</author>
47 47 <version>0:e63c23eaa88a</version>
48 48 <log>foo</log>
49 <url>http://hgserver/$TESTTMP/cia/rev/e63c23eaa88a</url>
50 <files><file uri="http://hgserver/$TESTTMP/cia/file/e63c23eaa88a/foo" action="add">foo</file></files>
49 <url>http://hgserver/rev/e63c23eaa88a</url>
50 <files><file uri="http://hgserver/file/e63c23eaa88a/foo" action="add">foo</file></files>
51 51 </commit>
52 52 </body>
53 53 <timestamp>0</timestamp>
54 54 </message>
55
56 $ cat >> $HGRCPATH <<EOF
57 > strip = 0
58 > EOF
59
60 $ echo bar > bar
61 $ hg ci -Ambar
62 adding bar
63 $ hg push ../cia
64 pushing to ../cia
65 searching for changes
66 adding changesets
67 adding manifests
68 adding file changes
69 added 1 changesets with 1 changes to 1 files
70
71 <message>
72 <generator>
73 <name>Mercurial (hgcia)</name>
74 <version>0.1</version>
75 <url>http://hg.kublai.com/mercurial/hgcia</url>
76 <user>testuser</user>
77 </generator>
78 <source>
79 <project>testproject</project>
80 <branch>default</branch>
81 </source>
82 <body>
83 <commit>
84 <author>test</author>
85 <version>1:c0c7cf58edc5</version>
86 <log>bar</log>
87 <url>http://hgserver/$TESTTMP/cia/rev/c0c7cf58edc5</url>
88 <files><file uri="http://hgserver/$TESTTMP/cia/file/c0c7cf58edc5/bar" action="add">bar</file></files>
89 </commit>
90 </body>
91 <timestamp>0</timestamp>
92 </message>
General Comments 0
You need to be logged in to leave comments. Login now