##// END OF EJS Templates
hgweb: add a `web.view` to control filtering...
Pierre-Yves David -
r18522:36549fa7 stable
parent child Browse files
Show More
@@ -1,336 +1,345 b''
1 # hgweb/hgweb_mod.py - Web interface for a repository.
1 # hgweb/hgweb_mod.py - Web interface for a repository.
2 #
2 #
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 import os
9 import os
10 from mercurial import ui, hg, hook, error, encoding, templater, util
10 from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
11 from common import get_stat, ErrorResponse, permhooks, caching
11 from common import get_stat, ErrorResponse, permhooks, caching
12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
14 from request import wsgirequest
14 from request import wsgirequest
15 import webcommands, protocol, webutil
15 import webcommands, protocol, webutil
16
16
17 perms = {
17 perms = {
18 'changegroup': 'pull',
18 'changegroup': 'pull',
19 'changegroupsubset': 'pull',
19 'changegroupsubset': 'pull',
20 'getbundle': 'pull',
20 'getbundle': 'pull',
21 'stream_out': 'pull',
21 'stream_out': 'pull',
22 'listkeys': 'pull',
22 'listkeys': 'pull',
23 'unbundle': 'push',
23 'unbundle': 'push',
24 'pushkey': 'push',
24 'pushkey': 'push',
25 }
25 }
26
26
27 def makebreadcrumb(url, prefix=''):
27 def makebreadcrumb(url, prefix=''):
28 '''Return a 'URL breadcrumb' list
28 '''Return a 'URL breadcrumb' list
29
29
30 A 'URL breadcrumb' is a list of URL-name pairs,
30 A 'URL breadcrumb' is a list of URL-name pairs,
31 corresponding to each of the path items on a URL.
31 corresponding to each of the path items on a URL.
32 This can be used to create path navigation entries.
32 This can be used to create path navigation entries.
33 '''
33 '''
34 if url.endswith('/'):
34 if url.endswith('/'):
35 url = url[:-1]
35 url = url[:-1]
36 if prefix:
36 if prefix:
37 url = '/' + prefix + url
37 url = '/' + prefix + url
38 relpath = url
38 relpath = url
39 if relpath.startswith('/'):
39 if relpath.startswith('/'):
40 relpath = relpath[1:]
40 relpath = relpath[1:]
41
41
42 breadcrumb = []
42 breadcrumb = []
43 urlel = url
43 urlel = url
44 pathitems = [''] + relpath.split('/')
44 pathitems = [''] + relpath.split('/')
45 for pathel in reversed(pathitems):
45 for pathel in reversed(pathitems):
46 if not pathel or not urlel:
46 if not pathel or not urlel:
47 break
47 break
48 breadcrumb.append({'url': urlel, 'name': pathel})
48 breadcrumb.append({'url': urlel, 'name': pathel})
49 urlel = os.path.dirname(urlel)
49 urlel = os.path.dirname(urlel)
50 return reversed(breadcrumb)
50 return reversed(breadcrumb)
51
51
52
52
53 class hgweb(object):
53 class hgweb(object):
54 def __init__(self, repo, name=None, baseui=None):
54 def __init__(self, repo, name=None, baseui=None):
55 if isinstance(repo, str):
55 if isinstance(repo, str):
56 if baseui:
56 if baseui:
57 u = baseui.copy()
57 u = baseui.copy()
58 else:
58 else:
59 u = ui.ui()
59 u = ui.ui()
60 self.repo = hg.repository(u, repo)
60 self.repo = hg.repository(u, repo)
61 else:
61 else:
62 self.repo = repo
62 self.repo = repo
63
63
64 self.repo = self.repo.filtered('served')
64 self.repo = self._getview(self.repo)
65 self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
65 self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
66 self.repo.ui.setconfig('ui', 'nontty', 'true')
66 self.repo.ui.setconfig('ui', 'nontty', 'true')
67 hook.redirect(True)
67 hook.redirect(True)
68 self.mtime = -1
68 self.mtime = -1
69 self.size = -1
69 self.size = -1
70 self.reponame = name
70 self.reponame = name
71 self.archives = 'zip', 'gz', 'bz2'
71 self.archives = 'zip', 'gz', 'bz2'
72 self.stripecount = 1
72 self.stripecount = 1
73 # a repo owner may set web.templates in .hg/hgrc to get any file
73 # a repo owner may set web.templates in .hg/hgrc to get any file
74 # readable by the user running the CGI script
74 # readable by the user running the CGI script
75 self.templatepath = self.config('web', 'templates')
75 self.templatepath = self.config('web', 'templates')
76
76
77 # The CGI scripts are often run by a user different from the repo owner.
77 # The CGI scripts are often run by a user different from the repo owner.
78 # Trust the settings from the .hg/hgrc files by default.
78 # Trust the settings from the .hg/hgrc files by default.
79 def config(self, section, name, default=None, untrusted=True):
79 def config(self, section, name, default=None, untrusted=True):
80 return self.repo.ui.config(section, name, default,
80 return self.repo.ui.config(section, name, default,
81 untrusted=untrusted)
81 untrusted=untrusted)
82
82
83 def configbool(self, section, name, default=False, untrusted=True):
83 def configbool(self, section, name, default=False, untrusted=True):
84 return self.repo.ui.configbool(section, name, default,
84 return self.repo.ui.configbool(section, name, default,
85 untrusted=untrusted)
85 untrusted=untrusted)
86
86
87 def configlist(self, section, name, default=None, untrusted=True):
87 def configlist(self, section, name, default=None, untrusted=True):
88 return self.repo.ui.configlist(section, name, default,
88 return self.repo.ui.configlist(section, name, default,
89 untrusted=untrusted)
89 untrusted=untrusted)
90
90
91 def _getview(self, repo):
92 viewconfig = self.config('web', 'view', 'served')
93 if viewconfig == 'all':
94 return repo.unfiltered()
95 elif viewconfig in repoview.filtertable:
96 return repo.filtered(viewconfig)
97 else:
98 return repo.filtered('served')
99
91 def refresh(self, request=None):
100 def refresh(self, request=None):
92 if request:
101 if request:
93 self.repo.ui.environ = request.env
102 self.repo.ui.environ = request.env
94 st = get_stat(self.repo.spath)
103 st = get_stat(self.repo.spath)
95 # compare changelog size in addition to mtime to catch
104 # compare changelog size in addition to mtime to catch
96 # rollbacks made less than a second ago
105 # rollbacks made less than a second ago
97 if st.st_mtime != self.mtime or st.st_size != self.size:
106 if st.st_mtime != self.mtime or st.st_size != self.size:
98 self.mtime = st.st_mtime
107 self.mtime = st.st_mtime
99 self.size = st.st_size
108 self.size = st.st_size
100 self.repo = hg.repository(self.repo.ui, self.repo.root)
109 self.repo = hg.repository(self.repo.ui, self.repo.root)
101 self.repo = self.repo.filtered('served')
110 self.repo = self._getview(self.repo)
102 self.maxchanges = int(self.config("web", "maxchanges", 10))
111 self.maxchanges = int(self.config("web", "maxchanges", 10))
103 self.stripecount = int(self.config("web", "stripes", 1))
112 self.stripecount = int(self.config("web", "stripes", 1))
104 self.maxshortchanges = int(self.config("web", "maxshortchanges",
113 self.maxshortchanges = int(self.config("web", "maxshortchanges",
105 60))
114 60))
106 self.maxfiles = int(self.config("web", "maxfiles", 10))
115 self.maxfiles = int(self.config("web", "maxfiles", 10))
107 self.allowpull = self.configbool("web", "allowpull", True)
116 self.allowpull = self.configbool("web", "allowpull", True)
108 encoding.encoding = self.config("web", "encoding",
117 encoding.encoding = self.config("web", "encoding",
109 encoding.encoding)
118 encoding.encoding)
110
119
111 def run(self):
120 def run(self):
112 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
121 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
113 raise RuntimeError("This function is only intended to be "
122 raise RuntimeError("This function is only intended to be "
114 "called while running as a CGI script.")
123 "called while running as a CGI script.")
115 import mercurial.hgweb.wsgicgi as wsgicgi
124 import mercurial.hgweb.wsgicgi as wsgicgi
116 wsgicgi.launch(self)
125 wsgicgi.launch(self)
117
126
118 def __call__(self, env, respond):
127 def __call__(self, env, respond):
119 req = wsgirequest(env, respond)
128 req = wsgirequest(env, respond)
120 return self.run_wsgi(req)
129 return self.run_wsgi(req)
121
130
122 def run_wsgi(self, req):
131 def run_wsgi(self, req):
123
132
124 self.refresh(req)
133 self.refresh(req)
125
134
126 # work with CGI variables to create coherent structure
135 # work with CGI variables to create coherent structure
127 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
136 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
128
137
129 req.url = req.env['SCRIPT_NAME']
138 req.url = req.env['SCRIPT_NAME']
130 if not req.url.endswith('/'):
139 if not req.url.endswith('/'):
131 req.url += '/'
140 req.url += '/'
132 if 'REPO_NAME' in req.env:
141 if 'REPO_NAME' in req.env:
133 req.url += req.env['REPO_NAME'] + '/'
142 req.url += req.env['REPO_NAME'] + '/'
134
143
135 if 'PATH_INFO' in req.env:
144 if 'PATH_INFO' in req.env:
136 parts = req.env['PATH_INFO'].strip('/').split('/')
145 parts = req.env['PATH_INFO'].strip('/').split('/')
137 repo_parts = req.env.get('REPO_NAME', '').split('/')
146 repo_parts = req.env.get('REPO_NAME', '').split('/')
138 if parts[:len(repo_parts)] == repo_parts:
147 if parts[:len(repo_parts)] == repo_parts:
139 parts = parts[len(repo_parts):]
148 parts = parts[len(repo_parts):]
140 query = '/'.join(parts)
149 query = '/'.join(parts)
141 else:
150 else:
142 query = req.env['QUERY_STRING'].split('&', 1)[0]
151 query = req.env['QUERY_STRING'].split('&', 1)[0]
143 query = query.split(';', 1)[0]
152 query = query.split(';', 1)[0]
144
153
145 # process this if it's a protocol request
154 # process this if it's a protocol request
146 # protocol bits don't need to create any URLs
155 # protocol bits don't need to create any URLs
147 # and the clients always use the old URL structure
156 # and the clients always use the old URL structure
148
157
149 cmd = req.form.get('cmd', [''])[0]
158 cmd = req.form.get('cmd', [''])[0]
150 if protocol.iscmd(cmd):
159 if protocol.iscmd(cmd):
151 try:
160 try:
152 if query:
161 if query:
153 raise ErrorResponse(HTTP_NOT_FOUND)
162 raise ErrorResponse(HTTP_NOT_FOUND)
154 if cmd in perms:
163 if cmd in perms:
155 self.check_perm(req, perms[cmd])
164 self.check_perm(req, perms[cmd])
156 return protocol.call(self.repo, req, cmd)
165 return protocol.call(self.repo, req, cmd)
157 except ErrorResponse, inst:
166 except ErrorResponse, inst:
158 # A client that sends unbundle without 100-continue will
167 # A client that sends unbundle without 100-continue will
159 # break if we respond early.
168 # break if we respond early.
160 if (cmd == 'unbundle' and
169 if (cmd == 'unbundle' and
161 (req.env.get('HTTP_EXPECT',
170 (req.env.get('HTTP_EXPECT',
162 '').lower() != '100-continue') or
171 '').lower() != '100-continue') or
163 req.env.get('X-HgHttp2', '')):
172 req.env.get('X-HgHttp2', '')):
164 req.drain()
173 req.drain()
165 req.respond(inst, protocol.HGTYPE,
174 req.respond(inst, protocol.HGTYPE,
166 body='0\n%s\n' % inst.message)
175 body='0\n%s\n' % inst.message)
167 return ''
176 return ''
168
177
169 # translate user-visible url structure to internal structure
178 # translate user-visible url structure to internal structure
170
179
171 args = query.split('/', 2)
180 args = query.split('/', 2)
172 if 'cmd' not in req.form and args and args[0]:
181 if 'cmd' not in req.form and args and args[0]:
173
182
174 cmd = args.pop(0)
183 cmd = args.pop(0)
175 style = cmd.rfind('-')
184 style = cmd.rfind('-')
176 if style != -1:
185 if style != -1:
177 req.form['style'] = [cmd[:style]]
186 req.form['style'] = [cmd[:style]]
178 cmd = cmd[style + 1:]
187 cmd = cmd[style + 1:]
179
188
180 # avoid accepting e.g. style parameter as command
189 # avoid accepting e.g. style parameter as command
181 if util.safehasattr(webcommands, cmd):
190 if util.safehasattr(webcommands, cmd):
182 req.form['cmd'] = [cmd]
191 req.form['cmd'] = [cmd]
183 else:
192 else:
184 cmd = ''
193 cmd = ''
185
194
186 if cmd == 'static':
195 if cmd == 'static':
187 req.form['file'] = ['/'.join(args)]
196 req.form['file'] = ['/'.join(args)]
188 else:
197 else:
189 if args and args[0]:
198 if args and args[0]:
190 node = args.pop(0)
199 node = args.pop(0)
191 req.form['node'] = [node]
200 req.form['node'] = [node]
192 if args:
201 if args:
193 req.form['file'] = args
202 req.form['file'] = args
194
203
195 ua = req.env.get('HTTP_USER_AGENT', '')
204 ua = req.env.get('HTTP_USER_AGENT', '')
196 if cmd == 'rev' and 'mercurial' in ua:
205 if cmd == 'rev' and 'mercurial' in ua:
197 req.form['style'] = ['raw']
206 req.form['style'] = ['raw']
198
207
199 if cmd == 'archive':
208 if cmd == 'archive':
200 fn = req.form['node'][0]
209 fn = req.form['node'][0]
201 for type_, spec in self.archive_specs.iteritems():
210 for type_, spec in self.archive_specs.iteritems():
202 ext = spec[2]
211 ext = spec[2]
203 if fn.endswith(ext):
212 if fn.endswith(ext):
204 req.form['node'] = [fn[:-len(ext)]]
213 req.form['node'] = [fn[:-len(ext)]]
205 req.form['type'] = [type_]
214 req.form['type'] = [type_]
206
215
207 # process the web interface request
216 # process the web interface request
208
217
209 try:
218 try:
210 tmpl = self.templater(req)
219 tmpl = self.templater(req)
211 ctype = tmpl('mimetype', encoding=encoding.encoding)
220 ctype = tmpl('mimetype', encoding=encoding.encoding)
212 ctype = templater.stringify(ctype)
221 ctype = templater.stringify(ctype)
213
222
214 # check read permissions non-static content
223 # check read permissions non-static content
215 if cmd != 'static':
224 if cmd != 'static':
216 self.check_perm(req, None)
225 self.check_perm(req, None)
217
226
218 if cmd == '':
227 if cmd == '':
219 req.form['cmd'] = [tmpl.cache['default']]
228 req.form['cmd'] = [tmpl.cache['default']]
220 cmd = req.form['cmd'][0]
229 cmd = req.form['cmd'][0]
221
230
222 if self.configbool('web', 'cache', True):
231 if self.configbool('web', 'cache', True):
223 caching(self, req) # sets ETag header or raises NOT_MODIFIED
232 caching(self, req) # sets ETag header or raises NOT_MODIFIED
224 if cmd not in webcommands.__all__:
233 if cmd not in webcommands.__all__:
225 msg = 'no such method: %s' % cmd
234 msg = 'no such method: %s' % cmd
226 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
235 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
227 elif cmd == 'file' and 'raw' in req.form.get('style', []):
236 elif cmd == 'file' and 'raw' in req.form.get('style', []):
228 self.ctype = ctype
237 self.ctype = ctype
229 content = webcommands.rawfile(self, req, tmpl)
238 content = webcommands.rawfile(self, req, tmpl)
230 else:
239 else:
231 content = getattr(webcommands, cmd)(self, req, tmpl)
240 content = getattr(webcommands, cmd)(self, req, tmpl)
232 req.respond(HTTP_OK, ctype)
241 req.respond(HTTP_OK, ctype)
233
242
234 return content
243 return content
235
244
236 except (error.LookupError, error.RepoLookupError), err:
245 except (error.LookupError, error.RepoLookupError), err:
237 req.respond(HTTP_NOT_FOUND, ctype)
246 req.respond(HTTP_NOT_FOUND, ctype)
238 msg = str(err)
247 msg = str(err)
239 if util.safehasattr(err, 'name') and 'manifest' not in msg:
248 if util.safehasattr(err, 'name') and 'manifest' not in msg:
240 msg = 'revision not found: %s' % err.name
249 msg = 'revision not found: %s' % err.name
241 return tmpl('error', error=msg)
250 return tmpl('error', error=msg)
242 except (error.RepoError, error.RevlogError), inst:
251 except (error.RepoError, error.RevlogError), inst:
243 req.respond(HTTP_SERVER_ERROR, ctype)
252 req.respond(HTTP_SERVER_ERROR, ctype)
244 return tmpl('error', error=str(inst))
253 return tmpl('error', error=str(inst))
245 except ErrorResponse, inst:
254 except ErrorResponse, inst:
246 req.respond(inst, ctype)
255 req.respond(inst, ctype)
247 if inst.code == HTTP_NOT_MODIFIED:
256 if inst.code == HTTP_NOT_MODIFIED:
248 # Not allowed to return a body on a 304
257 # Not allowed to return a body on a 304
249 return ['']
258 return ['']
250 return tmpl('error', error=inst.message)
259 return tmpl('error', error=inst.message)
251
260
252 def templater(self, req):
261 def templater(self, req):
253
262
254 # determine scheme, port and server name
263 # determine scheme, port and server name
255 # this is needed to create absolute urls
264 # this is needed to create absolute urls
256
265
257 proto = req.env.get('wsgi.url_scheme')
266 proto = req.env.get('wsgi.url_scheme')
258 if proto == 'https':
267 if proto == 'https':
259 proto = 'https'
268 proto = 'https'
260 default_port = "443"
269 default_port = "443"
261 else:
270 else:
262 proto = 'http'
271 proto = 'http'
263 default_port = "80"
272 default_port = "80"
264
273
265 port = req.env["SERVER_PORT"]
274 port = req.env["SERVER_PORT"]
266 port = port != default_port and (":" + port) or ""
275 port = port != default_port and (":" + port) or ""
267 urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
276 urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
268 logourl = self.config("web", "logourl", "http://mercurial.selenic.com/")
277 logourl = self.config("web", "logourl", "http://mercurial.selenic.com/")
269 logoimg = self.config("web", "logoimg", "hglogo.png")
278 logoimg = self.config("web", "logoimg", "hglogo.png")
270 staticurl = self.config("web", "staticurl") or req.url + 'static/'
279 staticurl = self.config("web", "staticurl") or req.url + 'static/'
271 if not staticurl.endswith('/'):
280 if not staticurl.endswith('/'):
272 staticurl += '/'
281 staticurl += '/'
273
282
274 # some functions for the templater
283 # some functions for the templater
275
284
276 def header(**map):
285 def header(**map):
277 yield tmpl('header', encoding=encoding.encoding, **map)
286 yield tmpl('header', encoding=encoding.encoding, **map)
278
287
279 def footer(**map):
288 def footer(**map):
280 yield tmpl("footer", **map)
289 yield tmpl("footer", **map)
281
290
282 def motd(**map):
291 def motd(**map):
283 yield self.config("web", "motd", "")
292 yield self.config("web", "motd", "")
284
293
285 # figure out which style to use
294 # figure out which style to use
286
295
287 vars = {}
296 vars = {}
288 styles = (
297 styles = (
289 req.form.get('style', [None])[0],
298 req.form.get('style', [None])[0],
290 self.config('web', 'style'),
299 self.config('web', 'style'),
291 'paper',
300 'paper',
292 )
301 )
293 style, mapfile = templater.stylemap(styles, self.templatepath)
302 style, mapfile = templater.stylemap(styles, self.templatepath)
294 if style == styles[0]:
303 if style == styles[0]:
295 vars['style'] = style
304 vars['style'] = style
296
305
297 start = req.url[-1] == '?' and '&' or '?'
306 start = req.url[-1] == '?' and '&' or '?'
298 sessionvars = webutil.sessionvars(vars, start)
307 sessionvars = webutil.sessionvars(vars, start)
299
308
300 if not self.reponame:
309 if not self.reponame:
301 self.reponame = (self.config("web", "name")
310 self.reponame = (self.config("web", "name")
302 or req.env.get('REPO_NAME')
311 or req.env.get('REPO_NAME')
303 or req.url.strip('/') or self.repo.root)
312 or req.url.strip('/') or self.repo.root)
304
313
305 # create the templater
314 # create the templater
306
315
307 tmpl = templater.templater(mapfile,
316 tmpl = templater.templater(mapfile,
308 defaults={"url": req.url,
317 defaults={"url": req.url,
309 "logourl": logourl,
318 "logourl": logourl,
310 "logoimg": logoimg,
319 "logoimg": logoimg,
311 "staticurl": staticurl,
320 "staticurl": staticurl,
312 "urlbase": urlbase,
321 "urlbase": urlbase,
313 "repo": self.reponame,
322 "repo": self.reponame,
314 "header": header,
323 "header": header,
315 "footer": footer,
324 "footer": footer,
316 "motd": motd,
325 "motd": motd,
317 "sessionvars": sessionvars,
326 "sessionvars": sessionvars,
318 "pathdef": makebreadcrumb(req.url),
327 "pathdef": makebreadcrumb(req.url),
319 })
328 })
320 return tmpl
329 return tmpl
321
330
322 def archivelist(self, nodeid):
331 def archivelist(self, nodeid):
323 allowed = self.configlist("web", "allow_archive")
332 allowed = self.configlist("web", "allow_archive")
324 for i, spec in self.archive_specs.iteritems():
333 for i, spec in self.archive_specs.iteritems():
325 if i in allowed or self.configbool("web", "allow" + i):
334 if i in allowed or self.configbool("web", "allow" + i):
326 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
335 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
327
336
328 archive_specs = {
337 archive_specs = {
329 'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
338 'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
330 'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
339 'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
331 'zip': ('application/zip', 'zip', '.zip', None),
340 'zip': ('application/zip', 'zip', '.zip', None),
332 }
341 }
333
342
334 def check_perm(self, req, op):
343 def check_perm(self, req, op):
335 for hook in permhooks:
344 for hook in permhooks:
336 hook(self, req, op)
345 hook(self, req, op)
@@ -1,761 +1,779 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > graphlog=
3 > graphlog=
4 > [phases]
4 > [phases]
5 > # public changeset are not obsolete
5 > # public changeset are not obsolete
6 > publish=false
6 > publish=false
7 > EOF
7 > EOF
8 $ mkcommit() {
8 $ mkcommit() {
9 > echo "$1" > "$1"
9 > echo "$1" > "$1"
10 > hg add "$1"
10 > hg add "$1"
11 > hg ci -m "add $1"
11 > hg ci -m "add $1"
12 > }
12 > }
13 $ getid() {
13 $ getid() {
14 > hg id --debug --hidden -ir "desc('$1')"
14 > hg id --debug --hidden -ir "desc('$1')"
15 > }
15 > }
16
16
17 $ cat > debugkeys.py <<EOF
17 $ cat > debugkeys.py <<EOF
18 > def reposetup(ui, repo):
18 > def reposetup(ui, repo):
19 > class debugkeysrepo(repo.__class__):
19 > class debugkeysrepo(repo.__class__):
20 > def listkeys(self, namespace):
20 > def listkeys(self, namespace):
21 > ui.write('listkeys %s\n' % (namespace,))
21 > ui.write('listkeys %s\n' % (namespace,))
22 > return super(debugkeysrepo, self).listkeys(namespace)
22 > return super(debugkeysrepo, self).listkeys(namespace)
23 >
23 >
24 > if repo.local():
24 > if repo.local():
25 > repo.__class__ = debugkeysrepo
25 > repo.__class__ = debugkeysrepo
26 > EOF
26 > EOF
27
27
28 $ hg init tmpa
28 $ hg init tmpa
29 $ cd tmpa
29 $ cd tmpa
30 $ mkcommit kill_me
30 $ mkcommit kill_me
31
31
32 Checking that the feature is properly disabled
32 Checking that the feature is properly disabled
33
33
34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 abort: obsolete feature is not enabled on this repo
35 abort: obsolete feature is not enabled on this repo
36 [255]
36 [255]
37
37
38 Enabling it
38 Enabling it
39
39
40 $ cat > ../obs.py << EOF
40 $ cat > ../obs.py << EOF
41 > import mercurial.obsolete
41 > import mercurial.obsolete
42 > mercurial.obsolete._enabled = True
42 > mercurial.obsolete._enabled = True
43 > EOF
43 > EOF
44 $ echo '[extensions]' >> $HGRCPATH
44 $ echo '[extensions]' >> $HGRCPATH
45 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
45 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
46
46
47 Killing a single changeset without replacement
47 Killing a single changeset without replacement
48
48
49 $ hg debugobsolete 0
49 $ hg debugobsolete 0
50 abort: changeset references must be full hexadecimal node identifiers
50 abort: changeset references must be full hexadecimal node identifiers
51 [255]
51 [255]
52 $ hg debugobsolete '00'
52 $ hg debugobsolete '00'
53 abort: changeset references must be full hexadecimal node identifiers
53 abort: changeset references must be full hexadecimal node identifiers
54 [255]
54 [255]
55 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
55 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
56 $ hg debugobsolete
56 $ hg debugobsolete
57 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 {'date': '0 0', 'user': 'babar'}
57 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 {'date': '0 0', 'user': 'babar'}
58
58
59 (test that mercurial is not confused)
59 (test that mercurial is not confused)
60
60
61 $ hg up null --quiet # having 0 as parent prevents it to be hidden
61 $ hg up null --quiet # having 0 as parent prevents it to be hidden
62 $ hg tip
62 $ hg tip
63 changeset: -1:000000000000
63 changeset: -1:000000000000
64 tag: tip
64 tag: tip
65 user:
65 user:
66 date: Thu Jan 01 00:00:00 1970 +0000
66 date: Thu Jan 01 00:00:00 1970 +0000
67
67
68 $ hg up --hidden tip --quiet
68 $ hg up --hidden tip --quiet
69 $ cd ..
69 $ cd ..
70
70
71 Killing a single changeset with replacement
71 Killing a single changeset with replacement
72
72
73 $ hg init tmpb
73 $ hg init tmpb
74 $ cd tmpb
74 $ cd tmpb
75 $ mkcommit a
75 $ mkcommit a
76 $ mkcommit b
76 $ mkcommit b
77 $ mkcommit original_c
77 $ mkcommit original_c
78 $ hg up "desc('b')"
78 $ hg up "desc('b')"
79 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
79 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
80 $ mkcommit new_c
80 $ mkcommit new_c
81 created new head
81 created new head
82 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
82 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
83 $ hg debugobsolete --flag 12 `getid original_c` `getid new_c` -d '56 12'
83 $ hg debugobsolete --flag 12 `getid original_c` `getid new_c` -d '56 12'
84 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
84 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
85 2:245bde4270cd add original_c
85 2:245bde4270cd add original_c
86 $ hg debugobsolete
86 $ hg debugobsolete
87 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
87 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
88
88
89 do it again (it read the obsstore before adding new changeset)
89 do it again (it read the obsstore before adding new changeset)
90
90
91 $ hg up '.^'
91 $ hg up '.^'
92 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
92 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
93 $ mkcommit new_2_c
93 $ mkcommit new_2_c
94 created new head
94 created new head
95 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
95 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
96 $ hg debugobsolete
96 $ hg debugobsolete
97 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
97 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
98 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
98 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
99
99
100 Register two markers with a missing node
100 Register two markers with a missing node
101
101
102 $ hg up '.^'
102 $ hg up '.^'
103 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
103 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
104 $ mkcommit new_3_c
104 $ mkcommit new_3_c
105 created new head
105 created new head
106 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
106 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
107 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
107 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
108 $ hg debugobsolete
108 $ hg debugobsolete
109 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
109 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
110 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
110 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
111 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
111 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
112 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
112 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
113
113
114 Refuse pathological nullid successors
114 Refuse pathological nullid successors
115 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
115 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
116 transaction abort!
116 transaction abort!
117 rollback completed
117 rollback completed
118 abort: bad obsolescence marker detected: invalid successors nullid
118 abort: bad obsolescence marker detected: invalid successors nullid
119 [255]
119 [255]
120
120
121 Check that graphlog detect that a changeset is obsolete:
121 Check that graphlog detect that a changeset is obsolete:
122
122
123 $ hg glog
123 $ hg glog
124 @ changeset: 5:5601fb93a350
124 @ changeset: 5:5601fb93a350
125 | tag: tip
125 | tag: tip
126 | parent: 1:7c3bad9141dc
126 | parent: 1:7c3bad9141dc
127 | user: test
127 | user: test
128 | date: Thu Jan 01 00:00:00 1970 +0000
128 | date: Thu Jan 01 00:00:00 1970 +0000
129 | summary: add new_3_c
129 | summary: add new_3_c
130 |
130 |
131 o changeset: 1:7c3bad9141dc
131 o changeset: 1:7c3bad9141dc
132 | user: test
132 | user: test
133 | date: Thu Jan 01 00:00:00 1970 +0000
133 | date: Thu Jan 01 00:00:00 1970 +0000
134 | summary: add b
134 | summary: add b
135 |
135 |
136 o changeset: 0:1f0dee641bb7
136 o changeset: 0:1f0dee641bb7
137 user: test
137 user: test
138 date: Thu Jan 01 00:00:00 1970 +0000
138 date: Thu Jan 01 00:00:00 1970 +0000
139 summary: add a
139 summary: add a
140
140
141
141
142 check that heads does not report them
142 check that heads does not report them
143
143
144 $ hg heads
144 $ hg heads
145 changeset: 5:5601fb93a350
145 changeset: 5:5601fb93a350
146 tag: tip
146 tag: tip
147 parent: 1:7c3bad9141dc
147 parent: 1:7c3bad9141dc
148 user: test
148 user: test
149 date: Thu Jan 01 00:00:00 1970 +0000
149 date: Thu Jan 01 00:00:00 1970 +0000
150 summary: add new_3_c
150 summary: add new_3_c
151
151
152 $ hg heads --hidden
152 $ hg heads --hidden
153 changeset: 5:5601fb93a350
153 changeset: 5:5601fb93a350
154 tag: tip
154 tag: tip
155 parent: 1:7c3bad9141dc
155 parent: 1:7c3bad9141dc
156 user: test
156 user: test
157 date: Thu Jan 01 00:00:00 1970 +0000
157 date: Thu Jan 01 00:00:00 1970 +0000
158 summary: add new_3_c
158 summary: add new_3_c
159
159
160 changeset: 4:ca819180edb9
160 changeset: 4:ca819180edb9
161 parent: 1:7c3bad9141dc
161 parent: 1:7c3bad9141dc
162 user: test
162 user: test
163 date: Thu Jan 01 00:00:00 1970 +0000
163 date: Thu Jan 01 00:00:00 1970 +0000
164 summary: add new_2_c
164 summary: add new_2_c
165
165
166 changeset: 3:cdbce2fbb163
166 changeset: 3:cdbce2fbb163
167 parent: 1:7c3bad9141dc
167 parent: 1:7c3bad9141dc
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: add new_c
170 summary: add new_c
171
171
172 changeset: 2:245bde4270cd
172 changeset: 2:245bde4270cd
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: add original_c
175 summary: add original_c
176
176
177
177
178
178
179 check that summary does not report them
179 check that summary does not report them
180
180
181 $ hg init ../sink
181 $ hg init ../sink
182 $ echo '[paths]' >> .hg/hgrc
182 $ echo '[paths]' >> .hg/hgrc
183 $ echo 'default=../sink' >> .hg/hgrc
183 $ echo 'default=../sink' >> .hg/hgrc
184 $ hg summary --remote
184 $ hg summary --remote
185 parent: 5:5601fb93a350 tip
185 parent: 5:5601fb93a350 tip
186 add new_3_c
186 add new_3_c
187 branch: default
187 branch: default
188 commit: (clean)
188 commit: (clean)
189 update: (current)
189 update: (current)
190 remote: 3 outgoing
190 remote: 3 outgoing
191
191
192 $ hg summary --remote --hidden
192 $ hg summary --remote --hidden
193 parent: 5:5601fb93a350 tip
193 parent: 5:5601fb93a350 tip
194 add new_3_c
194 add new_3_c
195 branch: default
195 branch: default
196 commit: (clean)
196 commit: (clean)
197 update: 3 new changesets, 4 branch heads (merge)
197 update: 3 new changesets, 4 branch heads (merge)
198 remote: 3 outgoing
198 remote: 3 outgoing
199
199
200 check that various commands work well with filtering
200 check that various commands work well with filtering
201
201
202 $ hg tip
202 $ hg tip
203 changeset: 5:5601fb93a350
203 changeset: 5:5601fb93a350
204 tag: tip
204 tag: tip
205 parent: 1:7c3bad9141dc
205 parent: 1:7c3bad9141dc
206 user: test
206 user: test
207 date: Thu Jan 01 00:00:00 1970 +0000
207 date: Thu Jan 01 00:00:00 1970 +0000
208 summary: add new_3_c
208 summary: add new_3_c
209
209
210 $ hg log -r 6
210 $ hg log -r 6
211 abort: unknown revision '6'!
211 abort: unknown revision '6'!
212 [255]
212 [255]
213 $ hg log -r 4
213 $ hg log -r 4
214 abort: unknown revision '4'!
214 abort: unknown revision '4'!
215 [255]
215 [255]
216
216
217 Check that public changeset are not accounted as obsolete:
217 Check that public changeset are not accounted as obsolete:
218
218
219 $ hg --hidden phase --public 2
219 $ hg --hidden phase --public 2
220 $ hg --config 'extensions.graphlog=' glog
220 $ hg --config 'extensions.graphlog=' glog
221 @ changeset: 5:5601fb93a350
221 @ changeset: 5:5601fb93a350
222 | tag: tip
222 | tag: tip
223 | parent: 1:7c3bad9141dc
223 | parent: 1:7c3bad9141dc
224 | user: test
224 | user: test
225 | date: Thu Jan 01 00:00:00 1970 +0000
225 | date: Thu Jan 01 00:00:00 1970 +0000
226 | summary: add new_3_c
226 | summary: add new_3_c
227 |
227 |
228 | o changeset: 2:245bde4270cd
228 | o changeset: 2:245bde4270cd
229 |/ user: test
229 |/ user: test
230 | date: Thu Jan 01 00:00:00 1970 +0000
230 | date: Thu Jan 01 00:00:00 1970 +0000
231 | summary: add original_c
231 | summary: add original_c
232 |
232 |
233 o changeset: 1:7c3bad9141dc
233 o changeset: 1:7c3bad9141dc
234 | user: test
234 | user: test
235 | date: Thu Jan 01 00:00:00 1970 +0000
235 | date: Thu Jan 01 00:00:00 1970 +0000
236 | summary: add b
236 | summary: add b
237 |
237 |
238 o changeset: 0:1f0dee641bb7
238 o changeset: 0:1f0dee641bb7
239 user: test
239 user: test
240 date: Thu Jan 01 00:00:00 1970 +0000
240 date: Thu Jan 01 00:00:00 1970 +0000
241 summary: add a
241 summary: add a
242
242
243
243
244 And that bumped changeset are detected
244 And that bumped changeset are detected
245 --------------------------------------
245 --------------------------------------
246
246
247 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
247 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
248 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
248 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
249 the public changeset
249 the public changeset
250
250
251 $ hg log --hidden -r 'bumped()'
251 $ hg log --hidden -r 'bumped()'
252 changeset: 5:5601fb93a350
252 changeset: 5:5601fb93a350
253 tag: tip
253 tag: tip
254 parent: 1:7c3bad9141dc
254 parent: 1:7c3bad9141dc
255 user: test
255 user: test
256 date: Thu Jan 01 00:00:00 1970 +0000
256 date: Thu Jan 01 00:00:00 1970 +0000
257 summary: add new_3_c
257 summary: add new_3_c
258
258
259
259
260 And that we can't push bumped changeset
260 And that we can't push bumped changeset
261
261
262 $ hg push ../tmpa -r 0 --force #(make repo related)
262 $ hg push ../tmpa -r 0 --force #(make repo related)
263 pushing to ../tmpa
263 pushing to ../tmpa
264 searching for changes
264 searching for changes
265 warning: repository is unrelated
265 warning: repository is unrelated
266 adding changesets
266 adding changesets
267 adding manifests
267 adding manifests
268 adding file changes
268 adding file changes
269 added 1 changesets with 1 changes to 1 files (+1 heads)
269 added 1 changesets with 1 changes to 1 files (+1 heads)
270 $ hg push ../tmpa
270 $ hg push ../tmpa
271 pushing to ../tmpa
271 pushing to ../tmpa
272 searching for changes
272 searching for changes
273 abort: push includes bumped changeset: 5601fb93a350!
273 abort: push includes bumped changeset: 5601fb93a350!
274 [255]
274 [255]
275
275
276 Fixing "bumped" situation
276 Fixing "bumped" situation
277 We need to create a clone of 5 and add a special marker with a flag
277 We need to create a clone of 5 and add a special marker with a flag
278
278
279 $ hg up '5^'
279 $ hg up '5^'
280 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
280 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
281 $ hg revert -ar 5
281 $ hg revert -ar 5
282 adding new_3_c
282 adding new_3_c
283 $ hg ci -m 'add n3w_3_c'
283 $ hg ci -m 'add n3w_3_c'
284 created new head
284 created new head
285 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
285 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
286 $ hg log -r 'bumped()'
286 $ hg log -r 'bumped()'
287 $ hg log -G
287 $ hg log -G
288 @ changeset: 6:6f9641995072
288 @ changeset: 6:6f9641995072
289 | tag: tip
289 | tag: tip
290 | parent: 1:7c3bad9141dc
290 | parent: 1:7c3bad9141dc
291 | user: test
291 | user: test
292 | date: Thu Jan 01 00:00:00 1970 +0000
292 | date: Thu Jan 01 00:00:00 1970 +0000
293 | summary: add n3w_3_c
293 | summary: add n3w_3_c
294 |
294 |
295 | o changeset: 2:245bde4270cd
295 | o changeset: 2:245bde4270cd
296 |/ user: test
296 |/ user: test
297 | date: Thu Jan 01 00:00:00 1970 +0000
297 | date: Thu Jan 01 00:00:00 1970 +0000
298 | summary: add original_c
298 | summary: add original_c
299 |
299 |
300 o changeset: 1:7c3bad9141dc
300 o changeset: 1:7c3bad9141dc
301 | user: test
301 | user: test
302 | date: Thu Jan 01 00:00:00 1970 +0000
302 | date: Thu Jan 01 00:00:00 1970 +0000
303 | summary: add b
303 | summary: add b
304 |
304 |
305 o changeset: 0:1f0dee641bb7
305 o changeset: 0:1f0dee641bb7
306 user: test
306 user: test
307 date: Thu Jan 01 00:00:00 1970 +0000
307 date: Thu Jan 01 00:00:00 1970 +0000
308 summary: add a
308 summary: add a
309
309
310
310
311
311
312
312
313 $ cd ..
313 $ cd ..
314
314
315 Exchange Test
315 Exchange Test
316 ============================
316 ============================
317
317
318 Destination repo does not have any data
318 Destination repo does not have any data
319 ---------------------------------------
319 ---------------------------------------
320
320
321 Simple incoming test
321 Simple incoming test
322
322
323 $ hg init tmpc
323 $ hg init tmpc
324 $ cd tmpc
324 $ cd tmpc
325 $ hg incoming ../tmpb
325 $ hg incoming ../tmpb
326 comparing with ../tmpb
326 comparing with ../tmpb
327 changeset: 0:1f0dee641bb7
327 changeset: 0:1f0dee641bb7
328 user: test
328 user: test
329 date: Thu Jan 01 00:00:00 1970 +0000
329 date: Thu Jan 01 00:00:00 1970 +0000
330 summary: add a
330 summary: add a
331
331
332 changeset: 1:7c3bad9141dc
332 changeset: 1:7c3bad9141dc
333 user: test
333 user: test
334 date: Thu Jan 01 00:00:00 1970 +0000
334 date: Thu Jan 01 00:00:00 1970 +0000
335 summary: add b
335 summary: add b
336
336
337 changeset: 2:245bde4270cd
337 changeset: 2:245bde4270cd
338 user: test
338 user: test
339 date: Thu Jan 01 00:00:00 1970 +0000
339 date: Thu Jan 01 00:00:00 1970 +0000
340 summary: add original_c
340 summary: add original_c
341
341
342 changeset: 6:6f9641995072
342 changeset: 6:6f9641995072
343 tag: tip
343 tag: tip
344 parent: 1:7c3bad9141dc
344 parent: 1:7c3bad9141dc
345 user: test
345 user: test
346 date: Thu Jan 01 00:00:00 1970 +0000
346 date: Thu Jan 01 00:00:00 1970 +0000
347 summary: add n3w_3_c
347 summary: add n3w_3_c
348
348
349
349
350 Try to pull markers
350 Try to pull markers
351 (extinct changeset are excluded but marker are pushed)
351 (extinct changeset are excluded but marker are pushed)
352
352
353 $ hg pull ../tmpb
353 $ hg pull ../tmpb
354 pulling from ../tmpb
354 pulling from ../tmpb
355 requesting all changes
355 requesting all changes
356 adding changesets
356 adding changesets
357 adding manifests
357 adding manifests
358 adding file changes
358 adding file changes
359 added 4 changesets with 4 changes to 4 files (+1 heads)
359 added 4 changesets with 4 changes to 4 files (+1 heads)
360 (run 'hg heads' to see heads, 'hg merge' to merge)
360 (run 'hg heads' to see heads, 'hg merge' to merge)
361 $ hg debugobsolete
361 $ hg debugobsolete
362 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
362 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
363 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
363 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
364 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
364 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
365 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
365 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
366 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
366 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
367
367
368 Rollback//Transaction support
368 Rollback//Transaction support
369
369
370 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
370 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
371 $ hg debugobsolete
371 $ hg debugobsolete
372 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
372 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
373 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
373 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
374 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
374 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
375 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
375 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
376 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
376 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
377 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
377 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
378 $ hg rollback -n
378 $ hg rollback -n
379 repository tip rolled back to revision 3 (undo debugobsolete)
379 repository tip rolled back to revision 3 (undo debugobsolete)
380 $ hg rollback
380 $ hg rollback
381 repository tip rolled back to revision 3 (undo debugobsolete)
381 repository tip rolled back to revision 3 (undo debugobsolete)
382 $ hg debugobsolete
382 $ hg debugobsolete
383 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
383 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
384 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
384 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
385 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
385 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
386 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
386 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
387 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
387 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
388
388
389 $ cd ..
389 $ cd ..
390
390
391 Try to push markers
391 Try to push markers
392
392
393 $ hg init tmpd
393 $ hg init tmpd
394 $ hg -R tmpb push tmpd
394 $ hg -R tmpb push tmpd
395 pushing to tmpd
395 pushing to tmpd
396 searching for changes
396 searching for changes
397 adding changesets
397 adding changesets
398 adding manifests
398 adding manifests
399 adding file changes
399 adding file changes
400 added 4 changesets with 4 changes to 4 files (+1 heads)
400 added 4 changesets with 4 changes to 4 files (+1 heads)
401 $ hg -R tmpd debugobsolete
401 $ hg -R tmpd debugobsolete
402 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
402 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
403 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
403 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
404 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
404 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
405 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
405 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
406 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
406 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
407
407
408 Check obsolete keys are exchanged only if source has an obsolete store
408 Check obsolete keys are exchanged only if source has an obsolete store
409
409
410 $ hg init empty
410 $ hg init empty
411 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
411 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
412 pushing to tmpd
412 pushing to tmpd
413 no changes found
413 no changes found
414 listkeys phases
414 listkeys phases
415 listkeys bookmarks
415 listkeys bookmarks
416 [1]
416 [1]
417
417
418 clone support
418 clone support
419 (markers are copied and extinct changesets are included to allow hardlinks)
419 (markers are copied and extinct changesets are included to allow hardlinks)
420
420
421 $ hg clone tmpb clone-dest
421 $ hg clone tmpb clone-dest
422 updating to branch default
422 updating to branch default
423 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
423 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
424 $ hg -R clone-dest log -G --hidden
424 $ hg -R clone-dest log -G --hidden
425 @ changeset: 6:6f9641995072
425 @ changeset: 6:6f9641995072
426 | tag: tip
426 | tag: tip
427 | parent: 1:7c3bad9141dc
427 | parent: 1:7c3bad9141dc
428 | user: test
428 | user: test
429 | date: Thu Jan 01 00:00:00 1970 +0000
429 | date: Thu Jan 01 00:00:00 1970 +0000
430 | summary: add n3w_3_c
430 | summary: add n3w_3_c
431 |
431 |
432 | x changeset: 5:5601fb93a350
432 | x changeset: 5:5601fb93a350
433 |/ parent: 1:7c3bad9141dc
433 |/ parent: 1:7c3bad9141dc
434 | user: test
434 | user: test
435 | date: Thu Jan 01 00:00:00 1970 +0000
435 | date: Thu Jan 01 00:00:00 1970 +0000
436 | summary: add new_3_c
436 | summary: add new_3_c
437 |
437 |
438 | x changeset: 4:ca819180edb9
438 | x changeset: 4:ca819180edb9
439 |/ parent: 1:7c3bad9141dc
439 |/ parent: 1:7c3bad9141dc
440 | user: test
440 | user: test
441 | date: Thu Jan 01 00:00:00 1970 +0000
441 | date: Thu Jan 01 00:00:00 1970 +0000
442 | summary: add new_2_c
442 | summary: add new_2_c
443 |
443 |
444 | x changeset: 3:cdbce2fbb163
444 | x changeset: 3:cdbce2fbb163
445 |/ parent: 1:7c3bad9141dc
445 |/ parent: 1:7c3bad9141dc
446 | user: test
446 | user: test
447 | date: Thu Jan 01 00:00:00 1970 +0000
447 | date: Thu Jan 01 00:00:00 1970 +0000
448 | summary: add new_c
448 | summary: add new_c
449 |
449 |
450 | o changeset: 2:245bde4270cd
450 | o changeset: 2:245bde4270cd
451 |/ user: test
451 |/ user: test
452 | date: Thu Jan 01 00:00:00 1970 +0000
452 | date: Thu Jan 01 00:00:00 1970 +0000
453 | summary: add original_c
453 | summary: add original_c
454 |
454 |
455 o changeset: 1:7c3bad9141dc
455 o changeset: 1:7c3bad9141dc
456 | user: test
456 | user: test
457 | date: Thu Jan 01 00:00:00 1970 +0000
457 | date: Thu Jan 01 00:00:00 1970 +0000
458 | summary: add b
458 | summary: add b
459 |
459 |
460 o changeset: 0:1f0dee641bb7
460 o changeset: 0:1f0dee641bb7
461 user: test
461 user: test
462 date: Thu Jan 01 00:00:00 1970 +0000
462 date: Thu Jan 01 00:00:00 1970 +0000
463 summary: add a
463 summary: add a
464
464
465 $ hg -R clone-dest debugobsolete
465 $ hg -R clone-dest debugobsolete
466 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
466 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
467 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
467 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
468 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
468 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
469 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
469 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
470 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
470 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
471
471
472
472
473 Destination repo have existing data
473 Destination repo have existing data
474 ---------------------------------------
474 ---------------------------------------
475
475
476 On pull
476 On pull
477
477
478 $ hg init tmpe
478 $ hg init tmpe
479 $ cd tmpe
479 $ cd tmpe
480 $ hg debugobsolete -d '1339 0' 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339
480 $ hg debugobsolete -d '1339 0' 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339
481 $ hg pull ../tmpb
481 $ hg pull ../tmpb
482 pulling from ../tmpb
482 pulling from ../tmpb
483 requesting all changes
483 requesting all changes
484 adding changesets
484 adding changesets
485 adding manifests
485 adding manifests
486 adding file changes
486 adding file changes
487 added 4 changesets with 4 changes to 4 files (+1 heads)
487 added 4 changesets with 4 changes to 4 files (+1 heads)
488 (run 'hg heads' to see heads, 'hg merge' to merge)
488 (run 'hg heads' to see heads, 'hg merge' to merge)
489 $ hg debugobsolete
489 $ hg debugobsolete
490 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
490 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
491 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
491 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
492 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
492 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
493 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
493 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
494 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
494 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
495 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
495 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
496
496
497
497
498 On push
498 On push
499
499
500 $ hg push ../tmpc
500 $ hg push ../tmpc
501 pushing to ../tmpc
501 pushing to ../tmpc
502 searching for changes
502 searching for changes
503 no changes found
503 no changes found
504 [1]
504 [1]
505 $ hg -R ../tmpc debugobsolete
505 $ hg -R ../tmpc debugobsolete
506 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
506 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
507 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
507 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
508 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
508 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
509 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
509 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
510 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
510 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
511 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
511 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
512
512
513 detect outgoing obsolete and unstable
513 detect outgoing obsolete and unstable
514 ---------------------------------------
514 ---------------------------------------
515
515
516
516
517 $ hg glog
517 $ hg glog
518 o changeset: 3:6f9641995072
518 o changeset: 3:6f9641995072
519 | tag: tip
519 | tag: tip
520 | parent: 1:7c3bad9141dc
520 | parent: 1:7c3bad9141dc
521 | user: test
521 | user: test
522 | date: Thu Jan 01 00:00:00 1970 +0000
522 | date: Thu Jan 01 00:00:00 1970 +0000
523 | summary: add n3w_3_c
523 | summary: add n3w_3_c
524 |
524 |
525 | o changeset: 2:245bde4270cd
525 | o changeset: 2:245bde4270cd
526 |/ user: test
526 |/ user: test
527 | date: Thu Jan 01 00:00:00 1970 +0000
527 | date: Thu Jan 01 00:00:00 1970 +0000
528 | summary: add original_c
528 | summary: add original_c
529 |
529 |
530 o changeset: 1:7c3bad9141dc
530 o changeset: 1:7c3bad9141dc
531 | user: test
531 | user: test
532 | date: Thu Jan 01 00:00:00 1970 +0000
532 | date: Thu Jan 01 00:00:00 1970 +0000
533 | summary: add b
533 | summary: add b
534 |
534 |
535 o changeset: 0:1f0dee641bb7
535 o changeset: 0:1f0dee641bb7
536 user: test
536 user: test
537 date: Thu Jan 01 00:00:00 1970 +0000
537 date: Thu Jan 01 00:00:00 1970 +0000
538 summary: add a
538 summary: add a
539
539
540 $ hg up 'desc("n3w_3_c")'
540 $ hg up 'desc("n3w_3_c")'
541 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 $ mkcommit original_d
542 $ mkcommit original_d
543 $ mkcommit original_e
543 $ mkcommit original_e
544 $ hg debugobsolete `getid original_d` -d '0 0'
544 $ hg debugobsolete `getid original_d` -d '0 0'
545 $ hg log -r 'obsolete()'
545 $ hg log -r 'obsolete()'
546 changeset: 4:94b33453f93b
546 changeset: 4:94b33453f93b
547 user: test
547 user: test
548 date: Thu Jan 01 00:00:00 1970 +0000
548 date: Thu Jan 01 00:00:00 1970 +0000
549 summary: add original_d
549 summary: add original_d
550
550
551 $ hg glog -r '::unstable()'
551 $ hg glog -r '::unstable()'
552 @ changeset: 5:cda648ca50f5
552 @ changeset: 5:cda648ca50f5
553 | tag: tip
553 | tag: tip
554 | user: test
554 | user: test
555 | date: Thu Jan 01 00:00:00 1970 +0000
555 | date: Thu Jan 01 00:00:00 1970 +0000
556 | summary: add original_e
556 | summary: add original_e
557 |
557 |
558 x changeset: 4:94b33453f93b
558 x changeset: 4:94b33453f93b
559 | user: test
559 | user: test
560 | date: Thu Jan 01 00:00:00 1970 +0000
560 | date: Thu Jan 01 00:00:00 1970 +0000
561 | summary: add original_d
561 | summary: add original_d
562 |
562 |
563 o changeset: 3:6f9641995072
563 o changeset: 3:6f9641995072
564 | parent: 1:7c3bad9141dc
564 | parent: 1:7c3bad9141dc
565 | user: test
565 | user: test
566 | date: Thu Jan 01 00:00:00 1970 +0000
566 | date: Thu Jan 01 00:00:00 1970 +0000
567 | summary: add n3w_3_c
567 | summary: add n3w_3_c
568 |
568 |
569 o changeset: 1:7c3bad9141dc
569 o changeset: 1:7c3bad9141dc
570 | user: test
570 | user: test
571 | date: Thu Jan 01 00:00:00 1970 +0000
571 | date: Thu Jan 01 00:00:00 1970 +0000
572 | summary: add b
572 | summary: add b
573 |
573 |
574 o changeset: 0:1f0dee641bb7
574 o changeset: 0:1f0dee641bb7
575 user: test
575 user: test
576 date: Thu Jan 01 00:00:00 1970 +0000
576 date: Thu Jan 01 00:00:00 1970 +0000
577 summary: add a
577 summary: add a
578
578
579
579
580 refuse to push obsolete changeset
580 refuse to push obsolete changeset
581
581
582 $ hg push ../tmpc/ -r 'desc("original_d")'
582 $ hg push ../tmpc/ -r 'desc("original_d")'
583 pushing to ../tmpc/
583 pushing to ../tmpc/
584 searching for changes
584 searching for changes
585 abort: push includes obsolete changeset: 94b33453f93b!
585 abort: push includes obsolete changeset: 94b33453f93b!
586 [255]
586 [255]
587
587
588 refuse to push unstable changeset
588 refuse to push unstable changeset
589
589
590 $ hg push ../tmpc/
590 $ hg push ../tmpc/
591 pushing to ../tmpc/
591 pushing to ../tmpc/
592 searching for changes
592 searching for changes
593 abort: push includes unstable changeset: cda648ca50f5!
593 abort: push includes unstable changeset: cda648ca50f5!
594 [255]
594 [255]
595
595
596 Test that extinct changeset are properly detected
596 Test that extinct changeset are properly detected
597
597
598 $ hg log -r 'extinct()'
598 $ hg log -r 'extinct()'
599
599
600 Don't try to push extinct changeset
600 Don't try to push extinct changeset
601
601
602 $ hg init ../tmpf
602 $ hg init ../tmpf
603 $ hg out ../tmpf
603 $ hg out ../tmpf
604 comparing with ../tmpf
604 comparing with ../tmpf
605 searching for changes
605 searching for changes
606 changeset: 0:1f0dee641bb7
606 changeset: 0:1f0dee641bb7
607 user: test
607 user: test
608 date: Thu Jan 01 00:00:00 1970 +0000
608 date: Thu Jan 01 00:00:00 1970 +0000
609 summary: add a
609 summary: add a
610
610
611 changeset: 1:7c3bad9141dc
611 changeset: 1:7c3bad9141dc
612 user: test
612 user: test
613 date: Thu Jan 01 00:00:00 1970 +0000
613 date: Thu Jan 01 00:00:00 1970 +0000
614 summary: add b
614 summary: add b
615
615
616 changeset: 2:245bde4270cd
616 changeset: 2:245bde4270cd
617 user: test
617 user: test
618 date: Thu Jan 01 00:00:00 1970 +0000
618 date: Thu Jan 01 00:00:00 1970 +0000
619 summary: add original_c
619 summary: add original_c
620
620
621 changeset: 3:6f9641995072
621 changeset: 3:6f9641995072
622 parent: 1:7c3bad9141dc
622 parent: 1:7c3bad9141dc
623 user: test
623 user: test
624 date: Thu Jan 01 00:00:00 1970 +0000
624 date: Thu Jan 01 00:00:00 1970 +0000
625 summary: add n3w_3_c
625 summary: add n3w_3_c
626
626
627 changeset: 4:94b33453f93b
627 changeset: 4:94b33453f93b
628 user: test
628 user: test
629 date: Thu Jan 01 00:00:00 1970 +0000
629 date: Thu Jan 01 00:00:00 1970 +0000
630 summary: add original_d
630 summary: add original_d
631
631
632 changeset: 5:cda648ca50f5
632 changeset: 5:cda648ca50f5
633 tag: tip
633 tag: tip
634 user: test
634 user: test
635 date: Thu Jan 01 00:00:00 1970 +0000
635 date: Thu Jan 01 00:00:00 1970 +0000
636 summary: add original_e
636 summary: add original_e
637
637
638 $ hg push ../tmpf -f # -f because be push unstable too
638 $ hg push ../tmpf -f # -f because be push unstable too
639 pushing to ../tmpf
639 pushing to ../tmpf
640 searching for changes
640 searching for changes
641 adding changesets
641 adding changesets
642 adding manifests
642 adding manifests
643 adding file changes
643 adding file changes
644 added 6 changesets with 6 changes to 6 files (+1 heads)
644 added 6 changesets with 6 changes to 6 files (+1 heads)
645
645
646 no warning displayed
646 no warning displayed
647
647
648 $ hg push ../tmpf
648 $ hg push ../tmpf
649 pushing to ../tmpf
649 pushing to ../tmpf
650 searching for changes
650 searching for changes
651 no changes found
651 no changes found
652 [1]
652 [1]
653
653
654 Do not warn about new head when the new head is a successors of a remote one
654 Do not warn about new head when the new head is a successors of a remote one
655
655
656 $ hg glog
656 $ hg glog
657 @ changeset: 5:cda648ca50f5
657 @ changeset: 5:cda648ca50f5
658 | tag: tip
658 | tag: tip
659 | user: test
659 | user: test
660 | date: Thu Jan 01 00:00:00 1970 +0000
660 | date: Thu Jan 01 00:00:00 1970 +0000
661 | summary: add original_e
661 | summary: add original_e
662 |
662 |
663 x changeset: 4:94b33453f93b
663 x changeset: 4:94b33453f93b
664 | user: test
664 | user: test
665 | date: Thu Jan 01 00:00:00 1970 +0000
665 | date: Thu Jan 01 00:00:00 1970 +0000
666 | summary: add original_d
666 | summary: add original_d
667 |
667 |
668 o changeset: 3:6f9641995072
668 o changeset: 3:6f9641995072
669 | parent: 1:7c3bad9141dc
669 | parent: 1:7c3bad9141dc
670 | user: test
670 | user: test
671 | date: Thu Jan 01 00:00:00 1970 +0000
671 | date: Thu Jan 01 00:00:00 1970 +0000
672 | summary: add n3w_3_c
672 | summary: add n3w_3_c
673 |
673 |
674 | o changeset: 2:245bde4270cd
674 | o changeset: 2:245bde4270cd
675 |/ user: test
675 |/ user: test
676 | date: Thu Jan 01 00:00:00 1970 +0000
676 | date: Thu Jan 01 00:00:00 1970 +0000
677 | summary: add original_c
677 | summary: add original_c
678 |
678 |
679 o changeset: 1:7c3bad9141dc
679 o changeset: 1:7c3bad9141dc
680 | user: test
680 | user: test
681 | date: Thu Jan 01 00:00:00 1970 +0000
681 | date: Thu Jan 01 00:00:00 1970 +0000
682 | summary: add b
682 | summary: add b
683 |
683 |
684 o changeset: 0:1f0dee641bb7
684 o changeset: 0:1f0dee641bb7
685 user: test
685 user: test
686 date: Thu Jan 01 00:00:00 1970 +0000
686 date: Thu Jan 01 00:00:00 1970 +0000
687 summary: add a
687 summary: add a
688
688
689 $ hg up -q 'desc(n3w_3_c)'
689 $ hg up -q 'desc(n3w_3_c)'
690 $ mkcommit obsolete_e
690 $ mkcommit obsolete_e
691 created new head
691 created new head
692 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
692 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
693 $ hg outgoing ../tmpf # parasite hg outgoing testin
693 $ hg outgoing ../tmpf # parasite hg outgoing testin
694 comparing with ../tmpf
694 comparing with ../tmpf
695 searching for changes
695 searching for changes
696 changeset: 6:3de5eca88c00
696 changeset: 6:3de5eca88c00
697 tag: tip
697 tag: tip
698 parent: 3:6f9641995072
698 parent: 3:6f9641995072
699 user: test
699 user: test
700 date: Thu Jan 01 00:00:00 1970 +0000
700 date: Thu Jan 01 00:00:00 1970 +0000
701 summary: add obsolete_e
701 summary: add obsolete_e
702
702
703 $ hg push ../tmpf
703 $ hg push ../tmpf
704 pushing to ../tmpf
704 pushing to ../tmpf
705 searching for changes
705 searching for changes
706 adding changesets
706 adding changesets
707 adding manifests
707 adding manifests
708 adding file changes
708 adding file changes
709 added 1 changesets with 1 changes to 1 files (+1 heads)
709 added 1 changesets with 1 changes to 1 files (+1 heads)
710
710
711 #if serve
711 #if serve
712
712
713 check hgweb does not explode
713 check hgweb does not explode
714 ====================================
714 ====================================
715
715
716 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
716 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
717 adding changesets
717 adding changesets
718 adding manifests
718 adding manifests
719 adding file changes
719 adding file changes
720 added 62 changesets with 63 changes to 9 files (+60 heads)
720 added 62 changesets with 63 changes to 9 files (+60 heads)
721 (run 'hg heads .' to see heads, 'hg merge' to merge)
721 (run 'hg heads .' to see heads, 'hg merge' to merge)
722 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
722 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
723 > do
723 > do
724 > hg debugobsolete $node
724 > hg debugobsolete $node
725 > done
725 > done
726 $ hg up tip
726 $ hg up tip
727 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
727 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
728
728
729 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
729 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
730 $ cat hg.pid >> $DAEMON_PIDS
730 $ cat hg.pid >> $DAEMON_PIDS
731
731
732 check changelog view
732 check changelog view
733
733
734 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
734 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
735 200 Script output follows
735 200 Script output follows
736
736
737 check graph view
737 check graph view
738
738
739 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
739 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
740 200 Script output follows
740 200 Script output follows
741
741
742 check filelog view
742 check filelog view
743
743
744 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
744 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
745 200 Script output follows
745 200 Script output follows
746
747 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'
748 200 Script output follows
749 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
750 500 Internal Server Error
751 [1]
752
753 check that web.view config option:
754
755 $ kill `cat hg.pid`
756 $ cat >> .hg/hgrc << EOF
757 > [web]
758 > view=all
759 > EOF
760 $ wait
761 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
762 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
763 200 Script output follows
746 $ kill `cat hg.pid`
764 $ kill `cat hg.pid`
747
765
748 Checking _enable=False warning if obsolete marker exists
766 Checking _enable=False warning if obsolete marker exists
749
767
750 $ echo '[extensions]' >> $HGRCPATH
768 $ echo '[extensions]' >> $HGRCPATH
751 $ echo "obs=!" >> $HGRCPATH
769 $ echo "obs=!" >> $HGRCPATH
752 $ hg log -r tip
770 $ hg log -r tip
753 obsolete feature not enabled but 68 markers found!
771 obsolete feature not enabled but 68 markers found!
754 changeset: 68:c15e9edfca13
772 changeset: 68:c15e9edfca13
755 tag: tip
773 tag: tip
756 parent: 7:50c51b361e60
774 parent: 7:50c51b361e60
757 user: test
775 user: test
758 date: Thu Jan 01 00:00:00 1970 +0000
776 date: Thu Jan 01 00:00:00 1970 +0000
759 summary: add celestine
777 summary: add celestine
760
778
761 #endif
779 #endif
General Comments 0
You need to be logged in to leave comments. Login now