##// END OF EJS Templates
named branches: server branchmap wire protocol support (issue736)...
Henrik Stuart -
r8562:e3495c39 default
parent child Browse files
Show More
@@ -1,192 +1,204
1 #
1 #
2 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
2 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
7
7
8 import cStringIO, zlib, tempfile, errno, os, sys
8 import cStringIO, zlib, tempfile, errno, os, sys, urllib
9 from mercurial import util, streamclone
9 from mercurial import util, streamclone
10 from mercurial.node import bin, hex
10 from mercurial.node import bin, hex
11 from mercurial import changegroup as changegroupmod
11 from mercurial import changegroup as changegroupmod
12 from common import ErrorResponse, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
12 from common import ErrorResponse, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
13
13
14 # __all__ is populated with the allowed commands. Be sure to add to it if
14 # __all__ is populated with the allowed commands. Be sure to add to it if
15 # you're adding a new command, or the new command won't work.
15 # you're adding a new command, or the new command won't work.
16
16
17 __all__ = [
17 __all__ = [
18 'lookup', 'heads', 'branches', 'between', 'changegroup',
18 'lookup', 'heads', 'branches', 'between', 'changegroup',
19 'changegroupsubset', 'capabilities', 'unbundle', 'stream_out',
19 'changegroupsubset', 'capabilities', 'unbundle', 'stream_out',
20 'branchmap',
20 ]
21 ]
21
22
22 HGTYPE = 'application/mercurial-0.1'
23 HGTYPE = 'application/mercurial-0.1'
23
24
24 def lookup(repo, req):
25 def lookup(repo, req):
25 try:
26 try:
26 r = hex(repo.lookup(req.form['key'][0]))
27 r = hex(repo.lookup(req.form['key'][0]))
27 success = 1
28 success = 1
28 except Exception,inst:
29 except Exception,inst:
29 r = str(inst)
30 r = str(inst)
30 success = 0
31 success = 0
31 resp = "%s %s\n" % (success, r)
32 resp = "%s %s\n" % (success, r)
32 req.respond(HTTP_OK, HGTYPE, length=len(resp))
33 req.respond(HTTP_OK, HGTYPE, length=len(resp))
33 yield resp
34 yield resp
34
35
35 def heads(repo, req):
36 def heads(repo, req):
36 resp = " ".join(map(hex, repo.heads())) + "\n"
37 resp = " ".join(map(hex, repo.heads())) + "\n"
37 req.respond(HTTP_OK, HGTYPE, length=len(resp))
38 req.respond(HTTP_OK, HGTYPE, length=len(resp))
38 yield resp
39 yield resp
39
40
41 def branchmap(repo, req):
42 branches = repo.branchmap()
43 heads = []
44 for branch, nodes in branches.iteritems():
45 branchname = urllib.quote(branch)
46 branchnodes = [hex(node) for node in nodes]
47 heads.append('%s %s' % (branchname, ' '.join(branchnodes)))
48 resp = '\n'.join(heads)
49 req.respond(HTTP_OK, HGTYPE, length=len(resp))
50 yield resp
51
40 def branches(repo, req):
52 def branches(repo, req):
41 nodes = []
53 nodes = []
42 if 'nodes' in req.form:
54 if 'nodes' in req.form:
43 nodes = map(bin, req.form['nodes'][0].split(" "))
55 nodes = map(bin, req.form['nodes'][0].split(" "))
44 resp = cStringIO.StringIO()
56 resp = cStringIO.StringIO()
45 for b in repo.branches(nodes):
57 for b in repo.branches(nodes):
46 resp.write(" ".join(map(hex, b)) + "\n")
58 resp.write(" ".join(map(hex, b)) + "\n")
47 resp = resp.getvalue()
59 resp = resp.getvalue()
48 req.respond(HTTP_OK, HGTYPE, length=len(resp))
60 req.respond(HTTP_OK, HGTYPE, length=len(resp))
49 yield resp
61 yield resp
50
62
51 def between(repo, req):
63 def between(repo, req):
52 if 'pairs' in req.form:
64 if 'pairs' in req.form:
53 pairs = [map(bin, p.split("-"))
65 pairs = [map(bin, p.split("-"))
54 for p in req.form['pairs'][0].split(" ")]
66 for p in req.form['pairs'][0].split(" ")]
55 resp = cStringIO.StringIO()
67 resp = cStringIO.StringIO()
56 for b in repo.between(pairs):
68 for b in repo.between(pairs):
57 resp.write(" ".join(map(hex, b)) + "\n")
69 resp.write(" ".join(map(hex, b)) + "\n")
58 resp = resp.getvalue()
70 resp = resp.getvalue()
59 req.respond(HTTP_OK, HGTYPE, length=len(resp))
71 req.respond(HTTP_OK, HGTYPE, length=len(resp))
60 yield resp
72 yield resp
61
73
62 def changegroup(repo, req):
74 def changegroup(repo, req):
63 req.respond(HTTP_OK, HGTYPE)
75 req.respond(HTTP_OK, HGTYPE)
64 nodes = []
76 nodes = []
65
77
66 if 'roots' in req.form:
78 if 'roots' in req.form:
67 nodes = map(bin, req.form['roots'][0].split(" "))
79 nodes = map(bin, req.form['roots'][0].split(" "))
68
80
69 z = zlib.compressobj()
81 z = zlib.compressobj()
70 f = repo.changegroup(nodes, 'serve')
82 f = repo.changegroup(nodes, 'serve')
71 while 1:
83 while 1:
72 chunk = f.read(4096)
84 chunk = f.read(4096)
73 if not chunk:
85 if not chunk:
74 break
86 break
75 yield z.compress(chunk)
87 yield z.compress(chunk)
76
88
77 yield z.flush()
89 yield z.flush()
78
90
79 def changegroupsubset(repo, req):
91 def changegroupsubset(repo, req):
80 req.respond(HTTP_OK, HGTYPE)
92 req.respond(HTTP_OK, HGTYPE)
81 bases = []
93 bases = []
82 heads = []
94 heads = []
83
95
84 if 'bases' in req.form:
96 if 'bases' in req.form:
85 bases = [bin(x) for x in req.form['bases'][0].split(' ')]
97 bases = [bin(x) for x in req.form['bases'][0].split(' ')]
86 if 'heads' in req.form:
98 if 'heads' in req.form:
87 heads = [bin(x) for x in req.form['heads'][0].split(' ')]
99 heads = [bin(x) for x in req.form['heads'][0].split(' ')]
88
100
89 z = zlib.compressobj()
101 z = zlib.compressobj()
90 f = repo.changegroupsubset(bases, heads, 'serve')
102 f = repo.changegroupsubset(bases, heads, 'serve')
91 while 1:
103 while 1:
92 chunk = f.read(4096)
104 chunk = f.read(4096)
93 if not chunk:
105 if not chunk:
94 break
106 break
95 yield z.compress(chunk)
107 yield z.compress(chunk)
96
108
97 yield z.flush()
109 yield z.flush()
98
110
99 def capabilities(repo, req):
111 def capabilities(repo, req):
100 caps = ['lookup', 'changegroupsubset']
112 caps = ['lookup', 'changegroupsubset', 'branchmap']
101 if repo.ui.configbool('server', 'uncompressed', untrusted=True):
113 if repo.ui.configbool('server', 'uncompressed', untrusted=True):
102 caps.append('stream=%d' % repo.changelog.version)
114 caps.append('stream=%d' % repo.changelog.version)
103 if changegroupmod.bundlepriority:
115 if changegroupmod.bundlepriority:
104 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
116 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
105 rsp = ' '.join(caps)
117 rsp = ' '.join(caps)
106 req.respond(HTTP_OK, HGTYPE, length=len(rsp))
118 req.respond(HTTP_OK, HGTYPE, length=len(rsp))
107 yield rsp
119 yield rsp
108
120
109 def unbundle(repo, req):
121 def unbundle(repo, req):
110
122
111 proto = req.env.get('wsgi.url_scheme') or 'http'
123 proto = req.env.get('wsgi.url_scheme') or 'http'
112 their_heads = req.form['heads'][0].split(' ')
124 their_heads = req.form['heads'][0].split(' ')
113
125
114 def check_heads():
126 def check_heads():
115 heads = map(hex, repo.heads())
127 heads = map(hex, repo.heads())
116 return their_heads == [hex('force')] or their_heads == heads
128 return their_heads == [hex('force')] or their_heads == heads
117
129
118 # fail early if possible
130 # fail early if possible
119 if not check_heads():
131 if not check_heads():
120 req.drain()
132 req.drain()
121 raise ErrorResponse(HTTP_OK, 'unsynced changes')
133 raise ErrorResponse(HTTP_OK, 'unsynced changes')
122
134
123 # do not lock repo until all changegroup data is
135 # do not lock repo until all changegroup data is
124 # streamed. save to temporary file.
136 # streamed. save to temporary file.
125
137
126 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
138 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
127 fp = os.fdopen(fd, 'wb+')
139 fp = os.fdopen(fd, 'wb+')
128 try:
140 try:
129 length = int(req.env['CONTENT_LENGTH'])
141 length = int(req.env['CONTENT_LENGTH'])
130 for s in util.filechunkiter(req, limit=length):
142 for s in util.filechunkiter(req, limit=length):
131 fp.write(s)
143 fp.write(s)
132
144
133 try:
145 try:
134 lock = repo.lock()
146 lock = repo.lock()
135 try:
147 try:
136 if not check_heads():
148 if not check_heads():
137 raise ErrorResponse(HTTP_OK, 'unsynced changes')
149 raise ErrorResponse(HTTP_OK, 'unsynced changes')
138
150
139 fp.seek(0)
151 fp.seek(0)
140 header = fp.read(6)
152 header = fp.read(6)
141 if header.startswith('HG') and not header.startswith('HG10'):
153 if header.startswith('HG') and not header.startswith('HG10'):
142 raise ValueError('unknown bundle version')
154 raise ValueError('unknown bundle version')
143 elif header not in changegroupmod.bundletypes:
155 elif header not in changegroupmod.bundletypes:
144 raise ValueError('unknown bundle compression type')
156 raise ValueError('unknown bundle compression type')
145 gen = changegroupmod.unbundle(header, fp)
157 gen = changegroupmod.unbundle(header, fp)
146
158
147 # send addchangegroup output to client
159 # send addchangegroup output to client
148
160
149 oldio = sys.stdout, sys.stderr
161 oldio = sys.stdout, sys.stderr
150 sys.stderr = sys.stdout = cStringIO.StringIO()
162 sys.stderr = sys.stdout = cStringIO.StringIO()
151
163
152 try:
164 try:
153 url = 'remote:%s:%s' % (proto,
165 url = 'remote:%s:%s' % (proto,
154 req.env.get('REMOTE_HOST', ''))
166 req.env.get('REMOTE_HOST', ''))
155 try:
167 try:
156 ret = repo.addchangegroup(gen, 'serve', url)
168 ret = repo.addchangegroup(gen, 'serve', url)
157 except util.Abort, inst:
169 except util.Abort, inst:
158 sys.stdout.write("abort: %s\n" % inst)
170 sys.stdout.write("abort: %s\n" % inst)
159 ret = 0
171 ret = 0
160 finally:
172 finally:
161 val = sys.stdout.getvalue()
173 val = sys.stdout.getvalue()
162 sys.stdout, sys.stderr = oldio
174 sys.stdout, sys.stderr = oldio
163 req.respond(HTTP_OK, HGTYPE)
175 req.respond(HTTP_OK, HGTYPE)
164 return '%d\n%s' % (ret, val),
176 return '%d\n%s' % (ret, val),
165 finally:
177 finally:
166 lock.release()
178 lock.release()
167 except ValueError, inst:
179 except ValueError, inst:
168 raise ErrorResponse(HTTP_OK, inst)
180 raise ErrorResponse(HTTP_OK, inst)
169 except (OSError, IOError), inst:
181 except (OSError, IOError), inst:
170 filename = getattr(inst, 'filename', '')
182 filename = getattr(inst, 'filename', '')
171 # Don't send our filesystem layout to the client
183 # Don't send our filesystem layout to the client
172 if filename.startswith(repo.root):
184 if filename.startswith(repo.root):
173 filename = filename[len(repo.root)+1:]
185 filename = filename[len(repo.root)+1:]
174 else:
186 else:
175 filename = ''
187 filename = ''
176 error = getattr(inst, 'strerror', 'Unknown error')
188 error = getattr(inst, 'strerror', 'Unknown error')
177 if inst.errno == errno.ENOENT:
189 if inst.errno == errno.ENOENT:
178 code = HTTP_NOT_FOUND
190 code = HTTP_NOT_FOUND
179 else:
191 else:
180 code = HTTP_SERVER_ERROR
192 code = HTTP_SERVER_ERROR
181 raise ErrorResponse(code, '%s: %s' % (error, filename))
193 raise ErrorResponse(code, '%s: %s' % (error, filename))
182 finally:
194 finally:
183 fp.close()
195 fp.close()
184 os.unlink(tempname)
196 os.unlink(tempname)
185
197
186 def stream_out(repo, req):
198 def stream_out(repo, req):
187 req.respond(HTTP_OK, HGTYPE)
199 req.respond(HTTP_OK, HGTYPE)
188 try:
200 try:
189 for chunk in streamclone.stream_out(repo, untrusted=True):
201 for chunk in streamclone.stream_out(repo, untrusted=True):
190 yield chunk
202 yield chunk
191 except streamclone.StreamException, inst:
203 except streamclone.StreamException, inst:
192 yield str(inst)
204 yield str(inst)
@@ -1,2074 +1,2074
1 # localrepo.py - read/write repository class for mercurial
1 # localrepo.py - read/write repository class for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
7
7
8 from node import bin, hex, nullid, nullrev, short
8 from node import bin, hex, nullid, nullrev, short
9 from i18n import _
9 from i18n import _
10 import repo, changegroup
10 import repo, changegroup
11 import changelog, dirstate, filelog, manifest, context
11 import changelog, dirstate, filelog, manifest, context
12 import lock, transaction, store, encoding
12 import lock, transaction, store, encoding
13 import util, extensions, hook, error
13 import util, extensions, hook, error
14 import match as match_
14 import match as match_
15 import merge as merge_
15 import merge as merge_
16 from lock import release
16 from lock import release
17 import weakref, stat, errno, os, time, inspect
17 import weakref, stat, errno, os, time, inspect
18 propertycache = util.propertycache
18 propertycache = util.propertycache
19
19
20 class localrepository(repo.repository):
20 class localrepository(repo.repository):
21 capabilities = set(('lookup', 'changegroupsubset'))
21 capabilities = set(('lookup', 'changegroupsubset', 'branchmap'))
22 supported = set('revlogv1 store fncache'.split())
22 supported = set('revlogv1 store fncache'.split())
23
23
24 def __init__(self, baseui, path=None, create=0):
24 def __init__(self, baseui, path=None, create=0):
25 repo.repository.__init__(self)
25 repo.repository.__init__(self)
26 self.root = os.path.realpath(path)
26 self.root = os.path.realpath(path)
27 self.path = os.path.join(self.root, ".hg")
27 self.path = os.path.join(self.root, ".hg")
28 self.origroot = path
28 self.origroot = path
29 self.opener = util.opener(self.path)
29 self.opener = util.opener(self.path)
30 self.wopener = util.opener(self.root)
30 self.wopener = util.opener(self.root)
31
31
32 if not os.path.isdir(self.path):
32 if not os.path.isdir(self.path):
33 if create:
33 if create:
34 if not os.path.exists(path):
34 if not os.path.exists(path):
35 os.mkdir(path)
35 os.mkdir(path)
36 os.mkdir(self.path)
36 os.mkdir(self.path)
37 requirements = ["revlogv1"]
37 requirements = ["revlogv1"]
38 if baseui.configbool('format', 'usestore', True):
38 if baseui.configbool('format', 'usestore', True):
39 os.mkdir(os.path.join(self.path, "store"))
39 os.mkdir(os.path.join(self.path, "store"))
40 requirements.append("store")
40 requirements.append("store")
41 if baseui.configbool('format', 'usefncache', True):
41 if baseui.configbool('format', 'usefncache', True):
42 requirements.append("fncache")
42 requirements.append("fncache")
43 # create an invalid changelog
43 # create an invalid changelog
44 self.opener("00changelog.i", "a").write(
44 self.opener("00changelog.i", "a").write(
45 '\0\0\0\2' # represents revlogv2
45 '\0\0\0\2' # represents revlogv2
46 ' dummy changelog to prevent using the old repo layout'
46 ' dummy changelog to prevent using the old repo layout'
47 )
47 )
48 reqfile = self.opener("requires", "w")
48 reqfile = self.opener("requires", "w")
49 for r in requirements:
49 for r in requirements:
50 reqfile.write("%s\n" % r)
50 reqfile.write("%s\n" % r)
51 reqfile.close()
51 reqfile.close()
52 else:
52 else:
53 raise error.RepoError(_("repository %s not found") % path)
53 raise error.RepoError(_("repository %s not found") % path)
54 elif create:
54 elif create:
55 raise error.RepoError(_("repository %s already exists") % path)
55 raise error.RepoError(_("repository %s already exists") % path)
56 else:
56 else:
57 # find requirements
57 # find requirements
58 requirements = set()
58 requirements = set()
59 try:
59 try:
60 requirements = set(self.opener("requires").read().splitlines())
60 requirements = set(self.opener("requires").read().splitlines())
61 except IOError, inst:
61 except IOError, inst:
62 if inst.errno != errno.ENOENT:
62 if inst.errno != errno.ENOENT:
63 raise
63 raise
64 for r in requirements - self.supported:
64 for r in requirements - self.supported:
65 raise error.RepoError(_("requirement '%s' not supported") % r)
65 raise error.RepoError(_("requirement '%s' not supported") % r)
66
66
67 self.store = store.store(requirements, self.path, util.opener)
67 self.store = store.store(requirements, self.path, util.opener)
68 self.spath = self.store.path
68 self.spath = self.store.path
69 self.sopener = self.store.opener
69 self.sopener = self.store.opener
70 self.sjoin = self.store.join
70 self.sjoin = self.store.join
71 self.opener.createmode = self.store.createmode
71 self.opener.createmode = self.store.createmode
72
72
73 self.baseui = baseui
73 self.baseui = baseui
74 self.ui = baseui.copy()
74 self.ui = baseui.copy()
75 try:
75 try:
76 self.ui.readconfig(self.join("hgrc"), self.root)
76 self.ui.readconfig(self.join("hgrc"), self.root)
77 extensions.loadall(self.ui)
77 extensions.loadall(self.ui)
78 except IOError:
78 except IOError:
79 pass
79 pass
80
80
81 self.tagscache = None
81 self.tagscache = None
82 self._tagstypecache = None
82 self._tagstypecache = None
83 self.branchcache = None
83 self.branchcache = None
84 self._ubranchcache = None # UTF-8 version of branchcache
84 self._ubranchcache = None # UTF-8 version of branchcache
85 self._branchcachetip = None
85 self._branchcachetip = None
86 self.nodetagscache = None
86 self.nodetagscache = None
87 self.filterpats = {}
87 self.filterpats = {}
88 self._datafilters = {}
88 self._datafilters = {}
89 self._transref = self._lockref = self._wlockref = None
89 self._transref = self._lockref = self._wlockref = None
90
90
91 @propertycache
91 @propertycache
92 def changelog(self):
92 def changelog(self):
93 c = changelog.changelog(self.sopener)
93 c = changelog.changelog(self.sopener)
94 if 'HG_PENDING' in os.environ:
94 if 'HG_PENDING' in os.environ:
95 p = os.environ['HG_PENDING']
95 p = os.environ['HG_PENDING']
96 if p.startswith(self.root):
96 if p.startswith(self.root):
97 c.readpending('00changelog.i.a')
97 c.readpending('00changelog.i.a')
98 self.sopener.defversion = c.version
98 self.sopener.defversion = c.version
99 return c
99 return c
100
100
101 @propertycache
101 @propertycache
102 def manifest(self):
102 def manifest(self):
103 return manifest.manifest(self.sopener)
103 return manifest.manifest(self.sopener)
104
104
105 @propertycache
105 @propertycache
106 def dirstate(self):
106 def dirstate(self):
107 return dirstate.dirstate(self.opener, self.ui, self.root)
107 return dirstate.dirstate(self.opener, self.ui, self.root)
108
108
109 def __getitem__(self, changeid):
109 def __getitem__(self, changeid):
110 if changeid is None:
110 if changeid is None:
111 return context.workingctx(self)
111 return context.workingctx(self)
112 return context.changectx(self, changeid)
112 return context.changectx(self, changeid)
113
113
114 def __nonzero__(self):
114 def __nonzero__(self):
115 return True
115 return True
116
116
117 def __len__(self):
117 def __len__(self):
118 return len(self.changelog)
118 return len(self.changelog)
119
119
120 def __iter__(self):
120 def __iter__(self):
121 for i in xrange(len(self)):
121 for i in xrange(len(self)):
122 yield i
122 yield i
123
123
124 def url(self):
124 def url(self):
125 return 'file:' + self.root
125 return 'file:' + self.root
126
126
127 def hook(self, name, throw=False, **args):
127 def hook(self, name, throw=False, **args):
128 return hook.hook(self.ui, self, name, throw, **args)
128 return hook.hook(self.ui, self, name, throw, **args)
129
129
130 tag_disallowed = ':\r\n'
130 tag_disallowed = ':\r\n'
131
131
132 def _tag(self, names, node, message, local, user, date, extra={}):
132 def _tag(self, names, node, message, local, user, date, extra={}):
133 if isinstance(names, str):
133 if isinstance(names, str):
134 allchars = names
134 allchars = names
135 names = (names,)
135 names = (names,)
136 else:
136 else:
137 allchars = ''.join(names)
137 allchars = ''.join(names)
138 for c in self.tag_disallowed:
138 for c in self.tag_disallowed:
139 if c in allchars:
139 if c in allchars:
140 raise util.Abort(_('%r cannot be used in a tag name') % c)
140 raise util.Abort(_('%r cannot be used in a tag name') % c)
141
141
142 for name in names:
142 for name in names:
143 self.hook('pretag', throw=True, node=hex(node), tag=name,
143 self.hook('pretag', throw=True, node=hex(node), tag=name,
144 local=local)
144 local=local)
145
145
146 def writetags(fp, names, munge, prevtags):
146 def writetags(fp, names, munge, prevtags):
147 fp.seek(0, 2)
147 fp.seek(0, 2)
148 if prevtags and prevtags[-1] != '\n':
148 if prevtags and prevtags[-1] != '\n':
149 fp.write('\n')
149 fp.write('\n')
150 for name in names:
150 for name in names:
151 m = munge and munge(name) or name
151 m = munge and munge(name) or name
152 if self._tagstypecache and name in self._tagstypecache:
152 if self._tagstypecache and name in self._tagstypecache:
153 old = self.tagscache.get(name, nullid)
153 old = self.tagscache.get(name, nullid)
154 fp.write('%s %s\n' % (hex(old), m))
154 fp.write('%s %s\n' % (hex(old), m))
155 fp.write('%s %s\n' % (hex(node), m))
155 fp.write('%s %s\n' % (hex(node), m))
156 fp.close()
156 fp.close()
157
157
158 prevtags = ''
158 prevtags = ''
159 if local:
159 if local:
160 try:
160 try:
161 fp = self.opener('localtags', 'r+')
161 fp = self.opener('localtags', 'r+')
162 except IOError:
162 except IOError:
163 fp = self.opener('localtags', 'a')
163 fp = self.opener('localtags', 'a')
164 else:
164 else:
165 prevtags = fp.read()
165 prevtags = fp.read()
166
166
167 # local tags are stored in the current charset
167 # local tags are stored in the current charset
168 writetags(fp, names, None, prevtags)
168 writetags(fp, names, None, prevtags)
169 for name in names:
169 for name in names:
170 self.hook('tag', node=hex(node), tag=name, local=local)
170 self.hook('tag', node=hex(node), tag=name, local=local)
171 return
171 return
172
172
173 try:
173 try:
174 fp = self.wfile('.hgtags', 'rb+')
174 fp = self.wfile('.hgtags', 'rb+')
175 except IOError:
175 except IOError:
176 fp = self.wfile('.hgtags', 'ab')
176 fp = self.wfile('.hgtags', 'ab')
177 else:
177 else:
178 prevtags = fp.read()
178 prevtags = fp.read()
179
179
180 # committed tags are stored in UTF-8
180 # committed tags are stored in UTF-8
181 writetags(fp, names, encoding.fromlocal, prevtags)
181 writetags(fp, names, encoding.fromlocal, prevtags)
182
182
183 if '.hgtags' not in self.dirstate:
183 if '.hgtags' not in self.dirstate:
184 self.add(['.hgtags'])
184 self.add(['.hgtags'])
185
185
186 tagnode = self.commit(['.hgtags'], message, user, date, extra=extra)
186 tagnode = self.commit(['.hgtags'], message, user, date, extra=extra)
187
187
188 for name in names:
188 for name in names:
189 self.hook('tag', node=hex(node), tag=name, local=local)
189 self.hook('tag', node=hex(node), tag=name, local=local)
190
190
191 return tagnode
191 return tagnode
192
192
193 def tag(self, names, node, message, local, user, date):
193 def tag(self, names, node, message, local, user, date):
194 '''tag a revision with one or more symbolic names.
194 '''tag a revision with one or more symbolic names.
195
195
196 names is a list of strings or, when adding a single tag, names may be a
196 names is a list of strings or, when adding a single tag, names may be a
197 string.
197 string.
198
198
199 if local is True, the tags are stored in a per-repository file.
199 if local is True, the tags are stored in a per-repository file.
200 otherwise, they are stored in the .hgtags file, and a new
200 otherwise, they are stored in the .hgtags file, and a new
201 changeset is committed with the change.
201 changeset is committed with the change.
202
202
203 keyword arguments:
203 keyword arguments:
204
204
205 local: whether to store tags in non-version-controlled file
205 local: whether to store tags in non-version-controlled file
206 (default False)
206 (default False)
207
207
208 message: commit message to use if committing
208 message: commit message to use if committing
209
209
210 user: name of user to use if committing
210 user: name of user to use if committing
211
211
212 date: date tuple to use if committing'''
212 date: date tuple to use if committing'''
213
213
214 for x in self.status()[:5]:
214 for x in self.status()[:5]:
215 if '.hgtags' in x:
215 if '.hgtags' in x:
216 raise util.Abort(_('working copy of .hgtags is changed '
216 raise util.Abort(_('working copy of .hgtags is changed '
217 '(please commit .hgtags manually)'))
217 '(please commit .hgtags manually)'))
218
218
219 self.tags() # instantiate the cache
219 self.tags() # instantiate the cache
220 self._tag(names, node, message, local, user, date)
220 self._tag(names, node, message, local, user, date)
221
221
222 def tags(self):
222 def tags(self):
223 '''return a mapping of tag to node'''
223 '''return a mapping of tag to node'''
224 if self.tagscache:
224 if self.tagscache:
225 return self.tagscache
225 return self.tagscache
226
226
227 globaltags = {}
227 globaltags = {}
228 tagtypes = {}
228 tagtypes = {}
229
229
230 def readtags(lines, fn, tagtype):
230 def readtags(lines, fn, tagtype):
231 filetags = {}
231 filetags = {}
232 count = 0
232 count = 0
233
233
234 def warn(msg):
234 def warn(msg):
235 self.ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
235 self.ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
236
236
237 for l in lines:
237 for l in lines:
238 count += 1
238 count += 1
239 if not l:
239 if not l:
240 continue
240 continue
241 s = l.split(" ", 1)
241 s = l.split(" ", 1)
242 if len(s) != 2:
242 if len(s) != 2:
243 warn(_("cannot parse entry"))
243 warn(_("cannot parse entry"))
244 continue
244 continue
245 node, key = s
245 node, key = s
246 key = encoding.tolocal(key.strip()) # stored in UTF-8
246 key = encoding.tolocal(key.strip()) # stored in UTF-8
247 try:
247 try:
248 bin_n = bin(node)
248 bin_n = bin(node)
249 except TypeError:
249 except TypeError:
250 warn(_("node '%s' is not well formed") % node)
250 warn(_("node '%s' is not well formed") % node)
251 continue
251 continue
252 if bin_n not in self.changelog.nodemap:
252 if bin_n not in self.changelog.nodemap:
253 warn(_("tag '%s' refers to unknown node") % key)
253 warn(_("tag '%s' refers to unknown node") % key)
254 continue
254 continue
255
255
256 h = []
256 h = []
257 if key in filetags:
257 if key in filetags:
258 n, h = filetags[key]
258 n, h = filetags[key]
259 h.append(n)
259 h.append(n)
260 filetags[key] = (bin_n, h)
260 filetags[key] = (bin_n, h)
261
261
262 for k, nh in filetags.iteritems():
262 for k, nh in filetags.iteritems():
263 if k not in globaltags:
263 if k not in globaltags:
264 globaltags[k] = nh
264 globaltags[k] = nh
265 tagtypes[k] = tagtype
265 tagtypes[k] = tagtype
266 continue
266 continue
267
267
268 # we prefer the global tag if:
268 # we prefer the global tag if:
269 # it supercedes us OR
269 # it supercedes us OR
270 # mutual supercedes and it has a higher rank
270 # mutual supercedes and it has a higher rank
271 # otherwise we win because we're tip-most
271 # otherwise we win because we're tip-most
272 an, ah = nh
272 an, ah = nh
273 bn, bh = globaltags[k]
273 bn, bh = globaltags[k]
274 if (bn != an and an in bh and
274 if (bn != an and an in bh and
275 (bn not in ah or len(bh) > len(ah))):
275 (bn not in ah or len(bh) > len(ah))):
276 an = bn
276 an = bn
277 ah.extend([n for n in bh if n not in ah])
277 ah.extend([n for n in bh if n not in ah])
278 globaltags[k] = an, ah
278 globaltags[k] = an, ah
279 tagtypes[k] = tagtype
279 tagtypes[k] = tagtype
280
280
281 # read the tags file from each head, ending with the tip
281 # read the tags file from each head, ending with the tip
282 f = None
282 f = None
283 for rev, node, fnode in self._hgtagsnodes():
283 for rev, node, fnode in self._hgtagsnodes():
284 f = (f and f.filectx(fnode) or
284 f = (f and f.filectx(fnode) or
285 self.filectx('.hgtags', fileid=fnode))
285 self.filectx('.hgtags', fileid=fnode))
286 readtags(f.data().splitlines(), f, "global")
286 readtags(f.data().splitlines(), f, "global")
287
287
288 try:
288 try:
289 data = encoding.fromlocal(self.opener("localtags").read())
289 data = encoding.fromlocal(self.opener("localtags").read())
290 # localtags are stored in the local character set
290 # localtags are stored in the local character set
291 # while the internal tag table is stored in UTF-8
291 # while the internal tag table is stored in UTF-8
292 readtags(data.splitlines(), "localtags", "local")
292 readtags(data.splitlines(), "localtags", "local")
293 except IOError:
293 except IOError:
294 pass
294 pass
295
295
296 self.tagscache = {}
296 self.tagscache = {}
297 self._tagstypecache = {}
297 self._tagstypecache = {}
298 for k, nh in globaltags.iteritems():
298 for k, nh in globaltags.iteritems():
299 n = nh[0]
299 n = nh[0]
300 if n != nullid:
300 if n != nullid:
301 self.tagscache[k] = n
301 self.tagscache[k] = n
302 self._tagstypecache[k] = tagtypes[k]
302 self._tagstypecache[k] = tagtypes[k]
303 self.tagscache['tip'] = self.changelog.tip()
303 self.tagscache['tip'] = self.changelog.tip()
304 return self.tagscache
304 return self.tagscache
305
305
306 def tagtype(self, tagname):
306 def tagtype(self, tagname):
307 '''
307 '''
308 return the type of the given tag. result can be:
308 return the type of the given tag. result can be:
309
309
310 'local' : a local tag
310 'local' : a local tag
311 'global' : a global tag
311 'global' : a global tag
312 None : tag does not exist
312 None : tag does not exist
313 '''
313 '''
314
314
315 self.tags()
315 self.tags()
316
316
317 return self._tagstypecache.get(tagname)
317 return self._tagstypecache.get(tagname)
318
318
319 def _hgtagsnodes(self):
319 def _hgtagsnodes(self):
320 last = {}
320 last = {}
321 ret = []
321 ret = []
322 for node in reversed(self.heads()):
322 for node in reversed(self.heads()):
323 c = self[node]
323 c = self[node]
324 rev = c.rev()
324 rev = c.rev()
325 try:
325 try:
326 fnode = c.filenode('.hgtags')
326 fnode = c.filenode('.hgtags')
327 except error.LookupError:
327 except error.LookupError:
328 continue
328 continue
329 ret.append((rev, node, fnode))
329 ret.append((rev, node, fnode))
330 if fnode in last:
330 if fnode in last:
331 ret[last[fnode]] = None
331 ret[last[fnode]] = None
332 last[fnode] = len(ret) - 1
332 last[fnode] = len(ret) - 1
333 return [item for item in ret if item]
333 return [item for item in ret if item]
334
334
335 def tagslist(self):
335 def tagslist(self):
336 '''return a list of tags ordered by revision'''
336 '''return a list of tags ordered by revision'''
337 l = []
337 l = []
338 for t, n in self.tags().iteritems():
338 for t, n in self.tags().iteritems():
339 try:
339 try:
340 r = self.changelog.rev(n)
340 r = self.changelog.rev(n)
341 except:
341 except:
342 r = -2 # sort to the beginning of the list if unknown
342 r = -2 # sort to the beginning of the list if unknown
343 l.append((r, t, n))
343 l.append((r, t, n))
344 return [(t, n) for r, t, n in sorted(l)]
344 return [(t, n) for r, t, n in sorted(l)]
345
345
346 def nodetags(self, node):
346 def nodetags(self, node):
347 '''return the tags associated with a node'''
347 '''return the tags associated with a node'''
348 if not self.nodetagscache:
348 if not self.nodetagscache:
349 self.nodetagscache = {}
349 self.nodetagscache = {}
350 for t, n in self.tags().iteritems():
350 for t, n in self.tags().iteritems():
351 self.nodetagscache.setdefault(n, []).append(t)
351 self.nodetagscache.setdefault(n, []).append(t)
352 return self.nodetagscache.get(node, [])
352 return self.nodetagscache.get(node, [])
353
353
354 def _branchtags(self, partial, lrev):
354 def _branchtags(self, partial, lrev):
355 # TODO: rename this function?
355 # TODO: rename this function?
356 tiprev = len(self) - 1
356 tiprev = len(self) - 1
357 if lrev != tiprev:
357 if lrev != tiprev:
358 self._updatebranchcache(partial, lrev+1, tiprev+1)
358 self._updatebranchcache(partial, lrev+1, tiprev+1)
359 self._writebranchcache(partial, self.changelog.tip(), tiprev)
359 self._writebranchcache(partial, self.changelog.tip(), tiprev)
360
360
361 return partial
361 return partial
362
362
363 def _branchheads(self):
363 def branchmap(self):
364 tip = self.changelog.tip()
364 tip = self.changelog.tip()
365 if self.branchcache is not None and self._branchcachetip == tip:
365 if self.branchcache is not None and self._branchcachetip == tip:
366 return self.branchcache
366 return self.branchcache
367
367
368 oldtip = self._branchcachetip
368 oldtip = self._branchcachetip
369 self._branchcachetip = tip
369 self._branchcachetip = tip
370 if self.branchcache is None:
370 if self.branchcache is None:
371 self.branchcache = {} # avoid recursion in changectx
371 self.branchcache = {} # avoid recursion in changectx
372 else:
372 else:
373 self.branchcache.clear() # keep using the same dict
373 self.branchcache.clear() # keep using the same dict
374 if oldtip is None or oldtip not in self.changelog.nodemap:
374 if oldtip is None or oldtip not in self.changelog.nodemap:
375 partial, last, lrev = self._readbranchcache()
375 partial, last, lrev = self._readbranchcache()
376 else:
376 else:
377 lrev = self.changelog.rev(oldtip)
377 lrev = self.changelog.rev(oldtip)
378 partial = self._ubranchcache
378 partial = self._ubranchcache
379
379
380 self._branchtags(partial, lrev)
380 self._branchtags(partial, lrev)
381 # this private cache holds all heads (not just tips)
381 # this private cache holds all heads (not just tips)
382 self._ubranchcache = partial
382 self._ubranchcache = partial
383
383
384 # the branch cache is stored on disk as UTF-8, but in the local
384 # the branch cache is stored on disk as UTF-8, but in the local
385 # charset internally
385 # charset internally
386 for k, v in partial.iteritems():
386 for k, v in partial.iteritems():
387 self.branchcache[encoding.tolocal(k)] = v
387 self.branchcache[encoding.tolocal(k)] = v
388 return self.branchcache
388 return self.branchcache
389
389
390
390
391 def branchtags(self):
391 def branchtags(self):
392 '''return a dict where branch names map to the tipmost head of
392 '''return a dict where branch names map to the tipmost head of
393 the branch, open heads come before closed'''
393 the branch, open heads come before closed'''
394 bt = {}
394 bt = {}
395 for bn, heads in self._branchheads().iteritems():
395 for bn, heads in self.branchmap().iteritems():
396 head = None
396 head = None
397 for i in range(len(heads)-1, -1, -1):
397 for i in range(len(heads)-1, -1, -1):
398 h = heads[i]
398 h = heads[i]
399 if 'close' not in self.changelog.read(h)[5]:
399 if 'close' not in self.changelog.read(h)[5]:
400 head = h
400 head = h
401 break
401 break
402 # no open heads were found
402 # no open heads were found
403 if head is None:
403 if head is None:
404 head = heads[-1]
404 head = heads[-1]
405 bt[bn] = head
405 bt[bn] = head
406 return bt
406 return bt
407
407
408
408
409 def _readbranchcache(self):
409 def _readbranchcache(self):
410 partial = {}
410 partial = {}
411 try:
411 try:
412 f = self.opener("branchheads.cache")
412 f = self.opener("branchheads.cache")
413 lines = f.read().split('\n')
413 lines = f.read().split('\n')
414 f.close()
414 f.close()
415 except (IOError, OSError):
415 except (IOError, OSError):
416 return {}, nullid, nullrev
416 return {}, nullid, nullrev
417
417
418 try:
418 try:
419 last, lrev = lines.pop(0).split(" ", 1)
419 last, lrev = lines.pop(0).split(" ", 1)
420 last, lrev = bin(last), int(lrev)
420 last, lrev = bin(last), int(lrev)
421 if lrev >= len(self) or self[lrev].node() != last:
421 if lrev >= len(self) or self[lrev].node() != last:
422 # invalidate the cache
422 # invalidate the cache
423 raise ValueError('invalidating branch cache (tip differs)')
423 raise ValueError('invalidating branch cache (tip differs)')
424 for l in lines:
424 for l in lines:
425 if not l: continue
425 if not l: continue
426 node, label = l.split(" ", 1)
426 node, label = l.split(" ", 1)
427 partial.setdefault(label.strip(), []).append(bin(node))
427 partial.setdefault(label.strip(), []).append(bin(node))
428 except KeyboardInterrupt:
428 except KeyboardInterrupt:
429 raise
429 raise
430 except Exception, inst:
430 except Exception, inst:
431 if self.ui.debugflag:
431 if self.ui.debugflag:
432 self.ui.warn(str(inst), '\n')
432 self.ui.warn(str(inst), '\n')
433 partial, last, lrev = {}, nullid, nullrev
433 partial, last, lrev = {}, nullid, nullrev
434 return partial, last, lrev
434 return partial, last, lrev
435
435
436 def _writebranchcache(self, branches, tip, tiprev):
436 def _writebranchcache(self, branches, tip, tiprev):
437 try:
437 try:
438 f = self.opener("branchheads.cache", "w", atomictemp=True)
438 f = self.opener("branchheads.cache", "w", atomictemp=True)
439 f.write("%s %s\n" % (hex(tip), tiprev))
439 f.write("%s %s\n" % (hex(tip), tiprev))
440 for label, nodes in branches.iteritems():
440 for label, nodes in branches.iteritems():
441 for node in nodes:
441 for node in nodes:
442 f.write("%s %s\n" % (hex(node), label))
442 f.write("%s %s\n" % (hex(node), label))
443 f.rename()
443 f.rename()
444 except (IOError, OSError):
444 except (IOError, OSError):
445 pass
445 pass
446
446
447 def _updatebranchcache(self, partial, start, end):
447 def _updatebranchcache(self, partial, start, end):
448 for r in xrange(start, end):
448 for r in xrange(start, end):
449 c = self[r]
449 c = self[r]
450 b = c.branch()
450 b = c.branch()
451 bheads = partial.setdefault(b, [])
451 bheads = partial.setdefault(b, [])
452 bheads.append(c.node())
452 bheads.append(c.node())
453 for p in c.parents():
453 for p in c.parents():
454 pn = p.node()
454 pn = p.node()
455 if pn in bheads:
455 if pn in bheads:
456 bheads.remove(pn)
456 bheads.remove(pn)
457
457
458 def lookup(self, key):
458 def lookup(self, key):
459 if isinstance(key, int):
459 if isinstance(key, int):
460 return self.changelog.node(key)
460 return self.changelog.node(key)
461 elif key == '.':
461 elif key == '.':
462 return self.dirstate.parents()[0]
462 return self.dirstate.parents()[0]
463 elif key == 'null':
463 elif key == 'null':
464 return nullid
464 return nullid
465 elif key == 'tip':
465 elif key == 'tip':
466 return self.changelog.tip()
466 return self.changelog.tip()
467 n = self.changelog._match(key)
467 n = self.changelog._match(key)
468 if n:
468 if n:
469 return n
469 return n
470 if key in self.tags():
470 if key in self.tags():
471 return self.tags()[key]
471 return self.tags()[key]
472 if key in self.branchtags():
472 if key in self.branchtags():
473 return self.branchtags()[key]
473 return self.branchtags()[key]
474 n = self.changelog._partialmatch(key)
474 n = self.changelog._partialmatch(key)
475 if n:
475 if n:
476 return n
476 return n
477 try:
477 try:
478 if len(key) == 20:
478 if len(key) == 20:
479 key = hex(key)
479 key = hex(key)
480 except:
480 except:
481 pass
481 pass
482 raise error.RepoError(_("unknown revision '%s'") % key)
482 raise error.RepoError(_("unknown revision '%s'") % key)
483
483
484 def local(self):
484 def local(self):
485 return True
485 return True
486
486
487 def join(self, f):
487 def join(self, f):
488 return os.path.join(self.path, f)
488 return os.path.join(self.path, f)
489
489
490 def wjoin(self, f):
490 def wjoin(self, f):
491 return os.path.join(self.root, f)
491 return os.path.join(self.root, f)
492
492
493 def rjoin(self, f):
493 def rjoin(self, f):
494 return os.path.join(self.root, util.pconvert(f))
494 return os.path.join(self.root, util.pconvert(f))
495
495
496 def file(self, f):
496 def file(self, f):
497 if f[0] == '/':
497 if f[0] == '/':
498 f = f[1:]
498 f = f[1:]
499 return filelog.filelog(self.sopener, f)
499 return filelog.filelog(self.sopener, f)
500
500
501 def changectx(self, changeid):
501 def changectx(self, changeid):
502 return self[changeid]
502 return self[changeid]
503
503
504 def parents(self, changeid=None):
504 def parents(self, changeid=None):
505 '''get list of changectxs for parents of changeid'''
505 '''get list of changectxs for parents of changeid'''
506 return self[changeid].parents()
506 return self[changeid].parents()
507
507
508 def filectx(self, path, changeid=None, fileid=None):
508 def filectx(self, path, changeid=None, fileid=None):
509 """changeid can be a changeset revision, node, or tag.
509 """changeid can be a changeset revision, node, or tag.
510 fileid can be a file revision or node."""
510 fileid can be a file revision or node."""
511 return context.filectx(self, path, changeid, fileid)
511 return context.filectx(self, path, changeid, fileid)
512
512
513 def getcwd(self):
513 def getcwd(self):
514 return self.dirstate.getcwd()
514 return self.dirstate.getcwd()
515
515
516 def pathto(self, f, cwd=None):
516 def pathto(self, f, cwd=None):
517 return self.dirstate.pathto(f, cwd)
517 return self.dirstate.pathto(f, cwd)
518
518
519 def wfile(self, f, mode='r'):
519 def wfile(self, f, mode='r'):
520 return self.wopener(f, mode)
520 return self.wopener(f, mode)
521
521
522 def _link(self, f):
522 def _link(self, f):
523 return os.path.islink(self.wjoin(f))
523 return os.path.islink(self.wjoin(f))
524
524
525 def _filter(self, filter, filename, data):
525 def _filter(self, filter, filename, data):
526 if filter not in self.filterpats:
526 if filter not in self.filterpats:
527 l = []
527 l = []
528 for pat, cmd in self.ui.configitems(filter):
528 for pat, cmd in self.ui.configitems(filter):
529 if cmd == '!':
529 if cmd == '!':
530 continue
530 continue
531 mf = util.matcher(self.root, "", [pat], [], [])[1]
531 mf = util.matcher(self.root, "", [pat], [], [])[1]
532 fn = None
532 fn = None
533 params = cmd
533 params = cmd
534 for name, filterfn in self._datafilters.iteritems():
534 for name, filterfn in self._datafilters.iteritems():
535 if cmd.startswith(name):
535 if cmd.startswith(name):
536 fn = filterfn
536 fn = filterfn
537 params = cmd[len(name):].lstrip()
537 params = cmd[len(name):].lstrip()
538 break
538 break
539 if not fn:
539 if not fn:
540 fn = lambda s, c, **kwargs: util.filter(s, c)
540 fn = lambda s, c, **kwargs: util.filter(s, c)
541 # Wrap old filters not supporting keyword arguments
541 # Wrap old filters not supporting keyword arguments
542 if not inspect.getargspec(fn)[2]:
542 if not inspect.getargspec(fn)[2]:
543 oldfn = fn
543 oldfn = fn
544 fn = lambda s, c, **kwargs: oldfn(s, c)
544 fn = lambda s, c, **kwargs: oldfn(s, c)
545 l.append((mf, fn, params))
545 l.append((mf, fn, params))
546 self.filterpats[filter] = l
546 self.filterpats[filter] = l
547
547
548 for mf, fn, cmd in self.filterpats[filter]:
548 for mf, fn, cmd in self.filterpats[filter]:
549 if mf(filename):
549 if mf(filename):
550 self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
550 self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
551 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
551 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
552 break
552 break
553
553
554 return data
554 return data
555
555
556 def adddatafilter(self, name, filter):
556 def adddatafilter(self, name, filter):
557 self._datafilters[name] = filter
557 self._datafilters[name] = filter
558
558
559 def wread(self, filename):
559 def wread(self, filename):
560 if self._link(filename):
560 if self._link(filename):
561 data = os.readlink(self.wjoin(filename))
561 data = os.readlink(self.wjoin(filename))
562 else:
562 else:
563 data = self.wopener(filename, 'r').read()
563 data = self.wopener(filename, 'r').read()
564 return self._filter("encode", filename, data)
564 return self._filter("encode", filename, data)
565
565
566 def wwrite(self, filename, data, flags):
566 def wwrite(self, filename, data, flags):
567 data = self._filter("decode", filename, data)
567 data = self._filter("decode", filename, data)
568 try:
568 try:
569 os.unlink(self.wjoin(filename))
569 os.unlink(self.wjoin(filename))
570 except OSError:
570 except OSError:
571 pass
571 pass
572 if 'l' in flags:
572 if 'l' in flags:
573 self.wopener.symlink(data, filename)
573 self.wopener.symlink(data, filename)
574 else:
574 else:
575 self.wopener(filename, 'w').write(data)
575 self.wopener(filename, 'w').write(data)
576 if 'x' in flags:
576 if 'x' in flags:
577 util.set_flags(self.wjoin(filename), False, True)
577 util.set_flags(self.wjoin(filename), False, True)
578
578
579 def wwritedata(self, filename, data):
579 def wwritedata(self, filename, data):
580 return self._filter("decode", filename, data)
580 return self._filter("decode", filename, data)
581
581
582 def transaction(self):
582 def transaction(self):
583 tr = self._transref and self._transref() or None
583 tr = self._transref and self._transref() or None
584 if tr and tr.running():
584 if tr and tr.running():
585 return tr.nest()
585 return tr.nest()
586
586
587 # abort here if the journal already exists
587 # abort here if the journal already exists
588 if os.path.exists(self.sjoin("journal")):
588 if os.path.exists(self.sjoin("journal")):
589 raise error.RepoError(_("journal already exists - run hg recover"))
589 raise error.RepoError(_("journal already exists - run hg recover"))
590
590
591 # save dirstate for rollback
591 # save dirstate for rollback
592 try:
592 try:
593 ds = self.opener("dirstate").read()
593 ds = self.opener("dirstate").read()
594 except IOError:
594 except IOError:
595 ds = ""
595 ds = ""
596 self.opener("journal.dirstate", "w").write(ds)
596 self.opener("journal.dirstate", "w").write(ds)
597 self.opener("journal.branch", "w").write(self.dirstate.branch())
597 self.opener("journal.branch", "w").write(self.dirstate.branch())
598
598
599 renames = [(self.sjoin("journal"), self.sjoin("undo")),
599 renames = [(self.sjoin("journal"), self.sjoin("undo")),
600 (self.join("journal.dirstate"), self.join("undo.dirstate")),
600 (self.join("journal.dirstate"), self.join("undo.dirstate")),
601 (self.join("journal.branch"), self.join("undo.branch"))]
601 (self.join("journal.branch"), self.join("undo.branch"))]
602 tr = transaction.transaction(self.ui.warn, self.sopener,
602 tr = transaction.transaction(self.ui.warn, self.sopener,
603 self.sjoin("journal"),
603 self.sjoin("journal"),
604 aftertrans(renames),
604 aftertrans(renames),
605 self.store.createmode)
605 self.store.createmode)
606 self._transref = weakref.ref(tr)
606 self._transref = weakref.ref(tr)
607 return tr
607 return tr
608
608
609 def recover(self):
609 def recover(self):
610 lock = self.lock()
610 lock = self.lock()
611 try:
611 try:
612 if os.path.exists(self.sjoin("journal")):
612 if os.path.exists(self.sjoin("journal")):
613 self.ui.status(_("rolling back interrupted transaction\n"))
613 self.ui.status(_("rolling back interrupted transaction\n"))
614 transaction.rollback(self.sopener, self.sjoin("journal"), self.ui.warn)
614 transaction.rollback(self.sopener, self.sjoin("journal"), self.ui.warn)
615 self.invalidate()
615 self.invalidate()
616 return True
616 return True
617 else:
617 else:
618 self.ui.warn(_("no interrupted transaction available\n"))
618 self.ui.warn(_("no interrupted transaction available\n"))
619 return False
619 return False
620 finally:
620 finally:
621 lock.release()
621 lock.release()
622
622
623 def rollback(self):
623 def rollback(self):
624 wlock = lock = None
624 wlock = lock = None
625 try:
625 try:
626 wlock = self.wlock()
626 wlock = self.wlock()
627 lock = self.lock()
627 lock = self.lock()
628 if os.path.exists(self.sjoin("undo")):
628 if os.path.exists(self.sjoin("undo")):
629 self.ui.status(_("rolling back last transaction\n"))
629 self.ui.status(_("rolling back last transaction\n"))
630 transaction.rollback(self.sopener, self.sjoin("undo"), self.ui.warn)
630 transaction.rollback(self.sopener, self.sjoin("undo"), self.ui.warn)
631 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
631 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
632 try:
632 try:
633 branch = self.opener("undo.branch").read()
633 branch = self.opener("undo.branch").read()
634 self.dirstate.setbranch(branch)
634 self.dirstate.setbranch(branch)
635 except IOError:
635 except IOError:
636 self.ui.warn(_("Named branch could not be reset, "
636 self.ui.warn(_("Named branch could not be reset, "
637 "current branch still is: %s\n")
637 "current branch still is: %s\n")
638 % encoding.tolocal(self.dirstate.branch()))
638 % encoding.tolocal(self.dirstate.branch()))
639 self.invalidate()
639 self.invalidate()
640 self.dirstate.invalidate()
640 self.dirstate.invalidate()
641 else:
641 else:
642 self.ui.warn(_("no rollback information available\n"))
642 self.ui.warn(_("no rollback information available\n"))
643 finally:
643 finally:
644 release(lock, wlock)
644 release(lock, wlock)
645
645
646 def invalidate(self):
646 def invalidate(self):
647 for a in "changelog manifest".split():
647 for a in "changelog manifest".split():
648 if a in self.__dict__:
648 if a in self.__dict__:
649 delattr(self, a)
649 delattr(self, a)
650 self.tagscache = None
650 self.tagscache = None
651 self._tagstypecache = None
651 self._tagstypecache = None
652 self.nodetagscache = None
652 self.nodetagscache = None
653 self.branchcache = None
653 self.branchcache = None
654 self._ubranchcache = None
654 self._ubranchcache = None
655 self._branchcachetip = None
655 self._branchcachetip = None
656
656
657 def _lock(self, lockname, wait, releasefn, acquirefn, desc):
657 def _lock(self, lockname, wait, releasefn, acquirefn, desc):
658 try:
658 try:
659 l = lock.lock(lockname, 0, releasefn, desc=desc)
659 l = lock.lock(lockname, 0, releasefn, desc=desc)
660 except error.LockHeld, inst:
660 except error.LockHeld, inst:
661 if not wait:
661 if not wait:
662 raise
662 raise
663 self.ui.warn(_("waiting for lock on %s held by %r\n") %
663 self.ui.warn(_("waiting for lock on %s held by %r\n") %
664 (desc, inst.locker))
664 (desc, inst.locker))
665 # default to 600 seconds timeout
665 # default to 600 seconds timeout
666 l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")),
666 l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")),
667 releasefn, desc=desc)
667 releasefn, desc=desc)
668 if acquirefn:
668 if acquirefn:
669 acquirefn()
669 acquirefn()
670 return l
670 return l
671
671
672 def lock(self, wait=True):
672 def lock(self, wait=True):
673 l = self._lockref and self._lockref()
673 l = self._lockref and self._lockref()
674 if l is not None and l.held:
674 if l is not None and l.held:
675 l.lock()
675 l.lock()
676 return l
676 return l
677
677
678 l = self._lock(self.sjoin("lock"), wait, None, self.invalidate,
678 l = self._lock(self.sjoin("lock"), wait, None, self.invalidate,
679 _('repository %s') % self.origroot)
679 _('repository %s') % self.origroot)
680 self._lockref = weakref.ref(l)
680 self._lockref = weakref.ref(l)
681 return l
681 return l
682
682
683 def wlock(self, wait=True):
683 def wlock(self, wait=True):
684 l = self._wlockref and self._wlockref()
684 l = self._wlockref and self._wlockref()
685 if l is not None and l.held:
685 if l is not None and l.held:
686 l.lock()
686 l.lock()
687 return l
687 return l
688
688
689 l = self._lock(self.join("wlock"), wait, self.dirstate.write,
689 l = self._lock(self.join("wlock"), wait, self.dirstate.write,
690 self.dirstate.invalidate, _('working directory of %s') %
690 self.dirstate.invalidate, _('working directory of %s') %
691 self.origroot)
691 self.origroot)
692 self._wlockref = weakref.ref(l)
692 self._wlockref = weakref.ref(l)
693 return l
693 return l
694
694
695 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
695 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
696 """
696 """
697 commit an individual file as part of a larger transaction
697 commit an individual file as part of a larger transaction
698 """
698 """
699
699
700 fname = fctx.path()
700 fname = fctx.path()
701 text = fctx.data()
701 text = fctx.data()
702 flog = self.file(fname)
702 flog = self.file(fname)
703 fparent1 = manifest1.get(fname, nullid)
703 fparent1 = manifest1.get(fname, nullid)
704 fparent2 = fparent2o = manifest2.get(fname, nullid)
704 fparent2 = fparent2o = manifest2.get(fname, nullid)
705
705
706 meta = {}
706 meta = {}
707 copy = fctx.renamed()
707 copy = fctx.renamed()
708 if copy and copy[0] != fname:
708 if copy and copy[0] != fname:
709 # Mark the new revision of this file as a copy of another
709 # Mark the new revision of this file as a copy of another
710 # file. This copy data will effectively act as a parent
710 # file. This copy data will effectively act as a parent
711 # of this new revision. If this is a merge, the first
711 # of this new revision. If this is a merge, the first
712 # parent will be the nullid (meaning "look up the copy data")
712 # parent will be the nullid (meaning "look up the copy data")
713 # and the second one will be the other parent. For example:
713 # and the second one will be the other parent. For example:
714 #
714 #
715 # 0 --- 1 --- 3 rev1 changes file foo
715 # 0 --- 1 --- 3 rev1 changes file foo
716 # \ / rev2 renames foo to bar and changes it
716 # \ / rev2 renames foo to bar and changes it
717 # \- 2 -/ rev3 should have bar with all changes and
717 # \- 2 -/ rev3 should have bar with all changes and
718 # should record that bar descends from
718 # should record that bar descends from
719 # bar in rev2 and foo in rev1
719 # bar in rev2 and foo in rev1
720 #
720 #
721 # this allows this merge to succeed:
721 # this allows this merge to succeed:
722 #
722 #
723 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
723 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
724 # \ / merging rev3 and rev4 should use bar@rev2
724 # \ / merging rev3 and rev4 should use bar@rev2
725 # \- 2 --- 4 as the merge base
725 # \- 2 --- 4 as the merge base
726 #
726 #
727
727
728 cfname = copy[0]
728 cfname = copy[0]
729 crev = manifest1.get(cfname)
729 crev = manifest1.get(cfname)
730 newfparent = fparent2
730 newfparent = fparent2
731
731
732 if manifest2: # branch merge
732 if manifest2: # branch merge
733 if fparent2 == nullid or crev is None: # copied on remote side
733 if fparent2 == nullid or crev is None: # copied on remote side
734 if cfname in manifest2:
734 if cfname in manifest2:
735 crev = manifest2[cfname]
735 crev = manifest2[cfname]
736 newfparent = fparent1
736 newfparent = fparent1
737
737
738 # find source in nearest ancestor if we've lost track
738 # find source in nearest ancestor if we've lost track
739 if not crev:
739 if not crev:
740 self.ui.debug(_(" %s: searching for copy revision for %s\n") %
740 self.ui.debug(_(" %s: searching for copy revision for %s\n") %
741 (fname, cfname))
741 (fname, cfname))
742 for ancestor in self['.'].ancestors():
742 for ancestor in self['.'].ancestors():
743 if cfname in ancestor:
743 if cfname in ancestor:
744 crev = ancestor[cfname].filenode()
744 crev = ancestor[cfname].filenode()
745 break
745 break
746
746
747 self.ui.debug(_(" %s: copy %s:%s\n") % (fname, cfname, hex(crev)))
747 self.ui.debug(_(" %s: copy %s:%s\n") % (fname, cfname, hex(crev)))
748 meta["copy"] = cfname
748 meta["copy"] = cfname
749 meta["copyrev"] = hex(crev)
749 meta["copyrev"] = hex(crev)
750 fparent1, fparent2 = nullid, newfparent
750 fparent1, fparent2 = nullid, newfparent
751 elif fparent2 != nullid:
751 elif fparent2 != nullid:
752 # is one parent an ancestor of the other?
752 # is one parent an ancestor of the other?
753 fparentancestor = flog.ancestor(fparent1, fparent2)
753 fparentancestor = flog.ancestor(fparent1, fparent2)
754 if fparentancestor == fparent1:
754 if fparentancestor == fparent1:
755 fparent1, fparent2 = fparent2, nullid
755 fparent1, fparent2 = fparent2, nullid
756 elif fparentancestor == fparent2:
756 elif fparentancestor == fparent2:
757 fparent2 = nullid
757 fparent2 = nullid
758
758
759 # is the file changed?
759 # is the file changed?
760 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
760 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
761 changelist.append(fname)
761 changelist.append(fname)
762 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
762 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
763
763
764 # are just the flags changed during merge?
764 # are just the flags changed during merge?
765 if fparent1 != fparent2o and manifest1.flags(fname) != fctx.flags():
765 if fparent1 != fparent2o and manifest1.flags(fname) != fctx.flags():
766 changelist.append(fname)
766 changelist.append(fname)
767
767
768 return fparent1
768 return fparent1
769
769
770 def commit(self, files=None, text="", user=None, date=None, match=None,
770 def commit(self, files=None, text="", user=None, date=None, match=None,
771 force=False, editor=False, extra={}):
771 force=False, editor=False, extra={}):
772 """Add a new revision to current repository.
772 """Add a new revision to current repository.
773
773
774 Revision information is gathered from the working directory, files and
774 Revision information is gathered from the working directory, files and
775 match can be used to filter the committed files.
775 match can be used to filter the committed files.
776 If editor is supplied, it is called to get a commit message.
776 If editor is supplied, it is called to get a commit message.
777 """
777 """
778 wlock = self.wlock()
778 wlock = self.wlock()
779 try:
779 try:
780 p1, p2 = self.dirstate.parents()
780 p1, p2 = self.dirstate.parents()
781
781
782 if (not force and p2 != nullid and match and
782 if (not force and p2 != nullid and match and
783 (match.files() or match.anypats())):
783 (match.files() or match.anypats())):
784 raise util.Abort(_('cannot partially commit a merge '
784 raise util.Abort(_('cannot partially commit a merge '
785 '(do not specify files or patterns)'))
785 '(do not specify files or patterns)'))
786
786
787 if files:
787 if files:
788 modified, removed = [], []
788 modified, removed = [], []
789 for f in sorted(set(files)):
789 for f in sorted(set(files)):
790 s = self.dirstate[f]
790 s = self.dirstate[f]
791 if s in 'nma':
791 if s in 'nma':
792 modified.append(f)
792 modified.append(f)
793 elif s == 'r':
793 elif s == 'r':
794 removed.append(f)
794 removed.append(f)
795 else:
795 else:
796 self.ui.warn(_("%s not tracked!\n") % f)
796 self.ui.warn(_("%s not tracked!\n") % f)
797 changes = [modified, [], removed, [], []]
797 changes = [modified, [], removed, [], []]
798 else:
798 else:
799 changes = self.status(match=match)
799 changes = self.status(match=match)
800
800
801 if (not force and not extra.get("close") and p2 == nullid
801 if (not force and not extra.get("close") and p2 == nullid
802 and not (changes[0] or changes[1] or changes[2])
802 and not (changes[0] or changes[1] or changes[2])
803 and self[None].branch() == self['.'].branch()):
803 and self[None].branch() == self['.'].branch()):
804 self.ui.status(_("nothing changed\n"))
804 self.ui.status(_("nothing changed\n"))
805 return None
805 return None
806
806
807 ms = merge_.mergestate(self)
807 ms = merge_.mergestate(self)
808 for f in changes[0]:
808 for f in changes[0]:
809 if f in ms and ms[f] == 'u':
809 if f in ms and ms[f] == 'u':
810 raise util.Abort(_("unresolved merge conflicts "
810 raise util.Abort(_("unresolved merge conflicts "
811 "(see hg resolve)"))
811 "(see hg resolve)"))
812
812
813 wctx = context.workingctx(self, (p1, p2), text, user, date,
813 wctx = context.workingctx(self, (p1, p2), text, user, date,
814 extra, changes)
814 extra, changes)
815 if editor:
815 if editor:
816 wctx._text = editor(self, wctx,
816 wctx._text = editor(self, wctx,
817 changes[1], changes[0], changes[2])
817 changes[1], changes[0], changes[2])
818 ret = self.commitctx(wctx, True)
818 ret = self.commitctx(wctx, True)
819
819
820 # update dirstate and mergestate
820 # update dirstate and mergestate
821 for f in changes[0] + changes[1]:
821 for f in changes[0] + changes[1]:
822 self.dirstate.normal(f)
822 self.dirstate.normal(f)
823 for f in changes[2]:
823 for f in changes[2]:
824 self.dirstate.forget(f)
824 self.dirstate.forget(f)
825 self.dirstate.setparents(ret)
825 self.dirstate.setparents(ret)
826 ms.reset()
826 ms.reset()
827
827
828 return ret
828 return ret
829
829
830 finally:
830 finally:
831 wlock.release()
831 wlock.release()
832
832
833 def commitctx(self, ctx, error=False):
833 def commitctx(self, ctx, error=False):
834 """Add a new revision to current repository.
834 """Add a new revision to current repository.
835
835
836 Revision information is passed via the context argument.
836 Revision information is passed via the context argument.
837 """
837 """
838
838
839 tr = lock = None
839 tr = lock = None
840 removed = ctx.removed()
840 removed = ctx.removed()
841 p1, p2 = ctx.p1(), ctx.p2()
841 p1, p2 = ctx.p1(), ctx.p2()
842 m1 = p1.manifest().copy()
842 m1 = p1.manifest().copy()
843 m2 = p2.manifest()
843 m2 = p2.manifest()
844 user = ctx.user()
844 user = ctx.user()
845
845
846 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
846 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
847 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
847 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
848
848
849 lock = self.lock()
849 lock = self.lock()
850 try:
850 try:
851 tr = self.transaction()
851 tr = self.transaction()
852 trp = weakref.proxy(tr)
852 trp = weakref.proxy(tr)
853
853
854 # check in files
854 # check in files
855 new = {}
855 new = {}
856 changed = []
856 changed = []
857 linkrev = len(self)
857 linkrev = len(self)
858 for f in sorted(ctx.modified() + ctx.added()):
858 for f in sorted(ctx.modified() + ctx.added()):
859 self.ui.note(f + "\n")
859 self.ui.note(f + "\n")
860 try:
860 try:
861 fctx = ctx[f]
861 fctx = ctx[f]
862 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
862 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
863 changed)
863 changed)
864 m1.set(f, fctx.flags())
864 m1.set(f, fctx.flags())
865 except (OSError, IOError):
865 except (OSError, IOError):
866 if error:
866 if error:
867 self.ui.warn(_("trouble committing %s!\n") % f)
867 self.ui.warn(_("trouble committing %s!\n") % f)
868 raise
868 raise
869 else:
869 else:
870 removed.append(f)
870 removed.append(f)
871
871
872 # update manifest
872 # update manifest
873 m1.update(new)
873 m1.update(new)
874 removed = [f for f in sorted(removed) if f in m1 or f in m2]
874 removed = [f for f in sorted(removed) if f in m1 or f in m2]
875 drop = [f for f in removed if f in m1]
875 drop = [f for f in removed if f in m1]
876 for f in drop:
876 for f in drop:
877 del m1[f]
877 del m1[f]
878 mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
878 mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
879 p2.manifestnode(), (new, drop))
879 p2.manifestnode(), (new, drop))
880
880
881 # update changelog
881 # update changelog
882 self.changelog.delayupdate()
882 self.changelog.delayupdate()
883 n = self.changelog.add(mn, changed + removed, ctx.description(),
883 n = self.changelog.add(mn, changed + removed, ctx.description(),
884 trp, p1.node(), p2.node(),
884 trp, p1.node(), p2.node(),
885 user, ctx.date(), ctx.extra().copy())
885 user, ctx.date(), ctx.extra().copy())
886 p = lambda: self.changelog.writepending() and self.root or ""
886 p = lambda: self.changelog.writepending() and self.root or ""
887 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
887 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
888 parent2=xp2, pending=p)
888 parent2=xp2, pending=p)
889 self.changelog.finalize(trp)
889 self.changelog.finalize(trp)
890 tr.close()
890 tr.close()
891
891
892 if self.branchcache:
892 if self.branchcache:
893 self.branchtags()
893 self.branchtags()
894
894
895 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
895 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
896 return n
896 return n
897 finally:
897 finally:
898 del tr
898 del tr
899 lock.release()
899 lock.release()
900
900
901 def walk(self, match, node=None):
901 def walk(self, match, node=None):
902 '''
902 '''
903 walk recursively through the directory tree or a given
903 walk recursively through the directory tree or a given
904 changeset, finding all files matched by the match
904 changeset, finding all files matched by the match
905 function
905 function
906 '''
906 '''
907 return self[node].walk(match)
907 return self[node].walk(match)
908
908
909 def status(self, node1='.', node2=None, match=None,
909 def status(self, node1='.', node2=None, match=None,
910 ignored=False, clean=False, unknown=False):
910 ignored=False, clean=False, unknown=False):
911 """return status of files between two nodes or node and working directory
911 """return status of files between two nodes or node and working directory
912
912
913 If node1 is None, use the first dirstate parent instead.
913 If node1 is None, use the first dirstate parent instead.
914 If node2 is None, compare node1 with working directory.
914 If node2 is None, compare node1 with working directory.
915 """
915 """
916
916
917 def mfmatches(ctx):
917 def mfmatches(ctx):
918 mf = ctx.manifest().copy()
918 mf = ctx.manifest().copy()
919 for fn in mf.keys():
919 for fn in mf.keys():
920 if not match(fn):
920 if not match(fn):
921 del mf[fn]
921 del mf[fn]
922 return mf
922 return mf
923
923
924 if isinstance(node1, context.changectx):
924 if isinstance(node1, context.changectx):
925 ctx1 = node1
925 ctx1 = node1
926 else:
926 else:
927 ctx1 = self[node1]
927 ctx1 = self[node1]
928 if isinstance(node2, context.changectx):
928 if isinstance(node2, context.changectx):
929 ctx2 = node2
929 ctx2 = node2
930 else:
930 else:
931 ctx2 = self[node2]
931 ctx2 = self[node2]
932
932
933 working = ctx2.rev() is None
933 working = ctx2.rev() is None
934 parentworking = working and ctx1 == self['.']
934 parentworking = working and ctx1 == self['.']
935 match = match or match_.always(self.root, self.getcwd())
935 match = match or match_.always(self.root, self.getcwd())
936 listignored, listclean, listunknown = ignored, clean, unknown
936 listignored, listclean, listunknown = ignored, clean, unknown
937
937
938 # load earliest manifest first for caching reasons
938 # load earliest manifest first for caching reasons
939 if not working and ctx2.rev() < ctx1.rev():
939 if not working and ctx2.rev() < ctx1.rev():
940 ctx2.manifest()
940 ctx2.manifest()
941
941
942 if not parentworking:
942 if not parentworking:
943 def bad(f, msg):
943 def bad(f, msg):
944 if f not in ctx1:
944 if f not in ctx1:
945 self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg))
945 self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg))
946 return False
946 return False
947 match.bad = bad
947 match.bad = bad
948
948
949 if working: # we need to scan the working dir
949 if working: # we need to scan the working dir
950 s = self.dirstate.status(match, listignored, listclean, listunknown)
950 s = self.dirstate.status(match, listignored, listclean, listunknown)
951 cmp, modified, added, removed, deleted, unknown, ignored, clean = s
951 cmp, modified, added, removed, deleted, unknown, ignored, clean = s
952
952
953 # check for any possibly clean files
953 # check for any possibly clean files
954 if parentworking and cmp:
954 if parentworking and cmp:
955 fixup = []
955 fixup = []
956 # do a full compare of any files that might have changed
956 # do a full compare of any files that might have changed
957 for f in sorted(cmp):
957 for f in sorted(cmp):
958 if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
958 if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
959 or ctx1[f].cmp(ctx2[f].data())):
959 or ctx1[f].cmp(ctx2[f].data())):
960 modified.append(f)
960 modified.append(f)
961 else:
961 else:
962 fixup.append(f)
962 fixup.append(f)
963
963
964 if listclean:
964 if listclean:
965 clean += fixup
965 clean += fixup
966
966
967 # update dirstate for files that are actually clean
967 # update dirstate for files that are actually clean
968 if fixup:
968 if fixup:
969 wlock = None
969 wlock = None
970 try:
970 try:
971 try:
971 try:
972 # updating the dirstate is optional
972 # updating the dirstate is optional
973 # so we don't wait on the lock
973 # so we don't wait on the lock
974 wlock = self.wlock(False)
974 wlock = self.wlock(False)
975 for f in fixup:
975 for f in fixup:
976 self.dirstate.normal(f)
976 self.dirstate.normal(f)
977 except error.LockError:
977 except error.LockError:
978 pass
978 pass
979 finally:
979 finally:
980 release(wlock)
980 release(wlock)
981
981
982 if not parentworking:
982 if not parentworking:
983 mf1 = mfmatches(ctx1)
983 mf1 = mfmatches(ctx1)
984 if working:
984 if working:
985 # we are comparing working dir against non-parent
985 # we are comparing working dir against non-parent
986 # generate a pseudo-manifest for the working dir
986 # generate a pseudo-manifest for the working dir
987 mf2 = mfmatches(self['.'])
987 mf2 = mfmatches(self['.'])
988 for f in cmp + modified + added:
988 for f in cmp + modified + added:
989 mf2[f] = None
989 mf2[f] = None
990 mf2.set(f, ctx2.flags(f))
990 mf2.set(f, ctx2.flags(f))
991 for f in removed:
991 for f in removed:
992 if f in mf2:
992 if f in mf2:
993 del mf2[f]
993 del mf2[f]
994 else:
994 else:
995 # we are comparing two revisions
995 # we are comparing two revisions
996 deleted, unknown, ignored = [], [], []
996 deleted, unknown, ignored = [], [], []
997 mf2 = mfmatches(ctx2)
997 mf2 = mfmatches(ctx2)
998
998
999 modified, added, clean = [], [], []
999 modified, added, clean = [], [], []
1000 for fn in mf2:
1000 for fn in mf2:
1001 if fn in mf1:
1001 if fn in mf1:
1002 if (mf1.flags(fn) != mf2.flags(fn) or
1002 if (mf1.flags(fn) != mf2.flags(fn) or
1003 (mf1[fn] != mf2[fn] and
1003 (mf1[fn] != mf2[fn] and
1004 (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))):
1004 (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))):
1005 modified.append(fn)
1005 modified.append(fn)
1006 elif listclean:
1006 elif listclean:
1007 clean.append(fn)
1007 clean.append(fn)
1008 del mf1[fn]
1008 del mf1[fn]
1009 else:
1009 else:
1010 added.append(fn)
1010 added.append(fn)
1011 removed = mf1.keys()
1011 removed = mf1.keys()
1012
1012
1013 r = modified, added, removed, deleted, unknown, ignored, clean
1013 r = modified, added, removed, deleted, unknown, ignored, clean
1014 [l.sort() for l in r]
1014 [l.sort() for l in r]
1015 return r
1015 return r
1016
1016
1017 def add(self, list):
1017 def add(self, list):
1018 wlock = self.wlock()
1018 wlock = self.wlock()
1019 try:
1019 try:
1020 rejected = []
1020 rejected = []
1021 for f in list:
1021 for f in list:
1022 p = self.wjoin(f)
1022 p = self.wjoin(f)
1023 try:
1023 try:
1024 st = os.lstat(p)
1024 st = os.lstat(p)
1025 except:
1025 except:
1026 self.ui.warn(_("%s does not exist!\n") % f)
1026 self.ui.warn(_("%s does not exist!\n") % f)
1027 rejected.append(f)
1027 rejected.append(f)
1028 continue
1028 continue
1029 if st.st_size > 10000000:
1029 if st.st_size > 10000000:
1030 self.ui.warn(_("%s: files over 10MB may cause memory and"
1030 self.ui.warn(_("%s: files over 10MB may cause memory and"
1031 " performance problems\n"
1031 " performance problems\n"
1032 "(use 'hg revert %s' to unadd the file)\n")
1032 "(use 'hg revert %s' to unadd the file)\n")
1033 % (f, f))
1033 % (f, f))
1034 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1034 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1035 self.ui.warn(_("%s not added: only files and symlinks "
1035 self.ui.warn(_("%s not added: only files and symlinks "
1036 "supported currently\n") % f)
1036 "supported currently\n") % f)
1037 rejected.append(p)
1037 rejected.append(p)
1038 elif self.dirstate[f] in 'amn':
1038 elif self.dirstate[f] in 'amn':
1039 self.ui.warn(_("%s already tracked!\n") % f)
1039 self.ui.warn(_("%s already tracked!\n") % f)
1040 elif self.dirstate[f] == 'r':
1040 elif self.dirstate[f] == 'r':
1041 self.dirstate.normallookup(f)
1041 self.dirstate.normallookup(f)
1042 else:
1042 else:
1043 self.dirstate.add(f)
1043 self.dirstate.add(f)
1044 return rejected
1044 return rejected
1045 finally:
1045 finally:
1046 wlock.release()
1046 wlock.release()
1047
1047
1048 def forget(self, list):
1048 def forget(self, list):
1049 wlock = self.wlock()
1049 wlock = self.wlock()
1050 try:
1050 try:
1051 for f in list:
1051 for f in list:
1052 if self.dirstate[f] != 'a':
1052 if self.dirstate[f] != 'a':
1053 self.ui.warn(_("%s not added!\n") % f)
1053 self.ui.warn(_("%s not added!\n") % f)
1054 else:
1054 else:
1055 self.dirstate.forget(f)
1055 self.dirstate.forget(f)
1056 finally:
1056 finally:
1057 wlock.release()
1057 wlock.release()
1058
1058
1059 def remove(self, list, unlink=False):
1059 def remove(self, list, unlink=False):
1060 wlock = None
1060 wlock = None
1061 try:
1061 try:
1062 if unlink:
1062 if unlink:
1063 for f in list:
1063 for f in list:
1064 try:
1064 try:
1065 util.unlink(self.wjoin(f))
1065 util.unlink(self.wjoin(f))
1066 except OSError, inst:
1066 except OSError, inst:
1067 if inst.errno != errno.ENOENT:
1067 if inst.errno != errno.ENOENT:
1068 raise
1068 raise
1069 wlock = self.wlock()
1069 wlock = self.wlock()
1070 for f in list:
1070 for f in list:
1071 if unlink and os.path.exists(self.wjoin(f)):
1071 if unlink and os.path.exists(self.wjoin(f)):
1072 self.ui.warn(_("%s still exists!\n") % f)
1072 self.ui.warn(_("%s still exists!\n") % f)
1073 elif self.dirstate[f] == 'a':
1073 elif self.dirstate[f] == 'a':
1074 self.dirstate.forget(f)
1074 self.dirstate.forget(f)
1075 elif f not in self.dirstate:
1075 elif f not in self.dirstate:
1076 self.ui.warn(_("%s not tracked!\n") % f)
1076 self.ui.warn(_("%s not tracked!\n") % f)
1077 else:
1077 else:
1078 self.dirstate.remove(f)
1078 self.dirstate.remove(f)
1079 finally:
1079 finally:
1080 release(wlock)
1080 release(wlock)
1081
1081
1082 def undelete(self, list):
1082 def undelete(self, list):
1083 manifests = [self.manifest.read(self.changelog.read(p)[0])
1083 manifests = [self.manifest.read(self.changelog.read(p)[0])
1084 for p in self.dirstate.parents() if p != nullid]
1084 for p in self.dirstate.parents() if p != nullid]
1085 wlock = self.wlock()
1085 wlock = self.wlock()
1086 try:
1086 try:
1087 for f in list:
1087 for f in list:
1088 if self.dirstate[f] != 'r':
1088 if self.dirstate[f] != 'r':
1089 self.ui.warn(_("%s not removed!\n") % f)
1089 self.ui.warn(_("%s not removed!\n") % f)
1090 else:
1090 else:
1091 m = f in manifests[0] and manifests[0] or manifests[1]
1091 m = f in manifests[0] and manifests[0] or manifests[1]
1092 t = self.file(f).read(m[f])
1092 t = self.file(f).read(m[f])
1093 self.wwrite(f, t, m.flags(f))
1093 self.wwrite(f, t, m.flags(f))
1094 self.dirstate.normal(f)
1094 self.dirstate.normal(f)
1095 finally:
1095 finally:
1096 wlock.release()
1096 wlock.release()
1097
1097
1098 def copy(self, source, dest):
1098 def copy(self, source, dest):
1099 p = self.wjoin(dest)
1099 p = self.wjoin(dest)
1100 if not (os.path.exists(p) or os.path.islink(p)):
1100 if not (os.path.exists(p) or os.path.islink(p)):
1101 self.ui.warn(_("%s does not exist!\n") % dest)
1101 self.ui.warn(_("%s does not exist!\n") % dest)
1102 elif not (os.path.isfile(p) or os.path.islink(p)):
1102 elif not (os.path.isfile(p) or os.path.islink(p)):
1103 self.ui.warn(_("copy failed: %s is not a file or a "
1103 self.ui.warn(_("copy failed: %s is not a file or a "
1104 "symbolic link\n") % dest)
1104 "symbolic link\n") % dest)
1105 else:
1105 else:
1106 wlock = self.wlock()
1106 wlock = self.wlock()
1107 try:
1107 try:
1108 if self.dirstate[dest] in '?r':
1108 if self.dirstate[dest] in '?r':
1109 self.dirstate.add(dest)
1109 self.dirstate.add(dest)
1110 self.dirstate.copy(source, dest)
1110 self.dirstate.copy(source, dest)
1111 finally:
1111 finally:
1112 wlock.release()
1112 wlock.release()
1113
1113
1114 def heads(self, start=None, closed=True):
1114 def heads(self, start=None, closed=True):
1115 heads = self.changelog.heads(start)
1115 heads = self.changelog.heads(start)
1116 def display(head):
1116 def display(head):
1117 if closed:
1117 if closed:
1118 return True
1118 return True
1119 extras = self.changelog.read(head)[5]
1119 extras = self.changelog.read(head)[5]
1120 return ('close' not in extras)
1120 return ('close' not in extras)
1121 # sort the output in rev descending order
1121 # sort the output in rev descending order
1122 heads = [(-self.changelog.rev(h), h) for h in heads if display(h)]
1122 heads = [(-self.changelog.rev(h), h) for h in heads if display(h)]
1123 return [n for (r, n) in sorted(heads)]
1123 return [n for (r, n) in sorted(heads)]
1124
1124
1125 def branchheads(self, branch=None, start=None, closed=True):
1125 def branchheads(self, branch=None, start=None, closed=True):
1126 if branch is None:
1126 if branch is None:
1127 branch = self[None].branch()
1127 branch = self[None].branch()
1128 branches = self._branchheads()
1128 branches = self.branchmap()
1129 if branch not in branches:
1129 if branch not in branches:
1130 return []
1130 return []
1131 bheads = branches[branch]
1131 bheads = branches[branch]
1132 # the cache returns heads ordered lowest to highest
1132 # the cache returns heads ordered lowest to highest
1133 bheads.reverse()
1133 bheads.reverse()
1134 if start is not None:
1134 if start is not None:
1135 # filter out the heads that cannot be reached from startrev
1135 # filter out the heads that cannot be reached from startrev
1136 bheads = self.changelog.nodesbetween([start], bheads)[2]
1136 bheads = self.changelog.nodesbetween([start], bheads)[2]
1137 if not closed:
1137 if not closed:
1138 bheads = [h for h in bheads if
1138 bheads = [h for h in bheads if
1139 ('close' not in self.changelog.read(h)[5])]
1139 ('close' not in self.changelog.read(h)[5])]
1140 return bheads
1140 return bheads
1141
1141
1142 def branches(self, nodes):
1142 def branches(self, nodes):
1143 if not nodes:
1143 if not nodes:
1144 nodes = [self.changelog.tip()]
1144 nodes = [self.changelog.tip()]
1145 b = []
1145 b = []
1146 for n in nodes:
1146 for n in nodes:
1147 t = n
1147 t = n
1148 while 1:
1148 while 1:
1149 p = self.changelog.parents(n)
1149 p = self.changelog.parents(n)
1150 if p[1] != nullid or p[0] == nullid:
1150 if p[1] != nullid or p[0] == nullid:
1151 b.append((t, n, p[0], p[1]))
1151 b.append((t, n, p[0], p[1]))
1152 break
1152 break
1153 n = p[0]
1153 n = p[0]
1154 return b
1154 return b
1155
1155
1156 def between(self, pairs):
1156 def between(self, pairs):
1157 r = []
1157 r = []
1158
1158
1159 for top, bottom in pairs:
1159 for top, bottom in pairs:
1160 n, l, i = top, [], 0
1160 n, l, i = top, [], 0
1161 f = 1
1161 f = 1
1162
1162
1163 while n != bottom and n != nullid:
1163 while n != bottom and n != nullid:
1164 p = self.changelog.parents(n)[0]
1164 p = self.changelog.parents(n)[0]
1165 if i == f:
1165 if i == f:
1166 l.append(n)
1166 l.append(n)
1167 f = f * 2
1167 f = f * 2
1168 n = p
1168 n = p
1169 i += 1
1169 i += 1
1170
1170
1171 r.append(l)
1171 r.append(l)
1172
1172
1173 return r
1173 return r
1174
1174
1175 def findincoming(self, remote, base=None, heads=None, force=False):
1175 def findincoming(self, remote, base=None, heads=None, force=False):
1176 """Return list of roots of the subsets of missing nodes from remote
1176 """Return list of roots of the subsets of missing nodes from remote
1177
1177
1178 If base dict is specified, assume that these nodes and their parents
1178 If base dict is specified, assume that these nodes and their parents
1179 exist on the remote side and that no child of a node of base exists
1179 exist on the remote side and that no child of a node of base exists
1180 in both remote and self.
1180 in both remote and self.
1181 Furthermore base will be updated to include the nodes that exists
1181 Furthermore base will be updated to include the nodes that exists
1182 in self and remote but no children exists in self and remote.
1182 in self and remote but no children exists in self and remote.
1183 If a list of heads is specified, return only nodes which are heads
1183 If a list of heads is specified, return only nodes which are heads
1184 or ancestors of these heads.
1184 or ancestors of these heads.
1185
1185
1186 All the ancestors of base are in self and in remote.
1186 All the ancestors of base are in self and in remote.
1187 All the descendants of the list returned are missing in self.
1187 All the descendants of the list returned are missing in self.
1188 (and so we know that the rest of the nodes are missing in remote, see
1188 (and so we know that the rest of the nodes are missing in remote, see
1189 outgoing)
1189 outgoing)
1190 """
1190 """
1191 return self.findcommonincoming(remote, base, heads, force)[1]
1191 return self.findcommonincoming(remote, base, heads, force)[1]
1192
1192
1193 def findcommonincoming(self, remote, base=None, heads=None, force=False):
1193 def findcommonincoming(self, remote, base=None, heads=None, force=False):
1194 """Return a tuple (common, missing roots, heads) used to identify
1194 """Return a tuple (common, missing roots, heads) used to identify
1195 missing nodes from remote.
1195 missing nodes from remote.
1196
1196
1197 If base dict is specified, assume that these nodes and their parents
1197 If base dict is specified, assume that these nodes and their parents
1198 exist on the remote side and that no child of a node of base exists
1198 exist on the remote side and that no child of a node of base exists
1199 in both remote and self.
1199 in both remote and self.
1200 Furthermore base will be updated to include the nodes that exists
1200 Furthermore base will be updated to include the nodes that exists
1201 in self and remote but no children exists in self and remote.
1201 in self and remote but no children exists in self and remote.
1202 If a list of heads is specified, return only nodes which are heads
1202 If a list of heads is specified, return only nodes which are heads
1203 or ancestors of these heads.
1203 or ancestors of these heads.
1204
1204
1205 All the ancestors of base are in self and in remote.
1205 All the ancestors of base are in self and in remote.
1206 """
1206 """
1207 m = self.changelog.nodemap
1207 m = self.changelog.nodemap
1208 search = []
1208 search = []
1209 fetch = set()
1209 fetch = set()
1210 seen = set()
1210 seen = set()
1211 seenbranch = set()
1211 seenbranch = set()
1212 if base is None:
1212 if base is None:
1213 base = {}
1213 base = {}
1214
1214
1215 if not heads:
1215 if not heads:
1216 heads = remote.heads()
1216 heads = remote.heads()
1217
1217
1218 if self.changelog.tip() == nullid:
1218 if self.changelog.tip() == nullid:
1219 base[nullid] = 1
1219 base[nullid] = 1
1220 if heads != [nullid]:
1220 if heads != [nullid]:
1221 return [nullid], [nullid], list(heads)
1221 return [nullid], [nullid], list(heads)
1222 return [nullid], [], []
1222 return [nullid], [], []
1223
1223
1224 # assume we're closer to the tip than the root
1224 # assume we're closer to the tip than the root
1225 # and start by examining the heads
1225 # and start by examining the heads
1226 self.ui.status(_("searching for changes\n"))
1226 self.ui.status(_("searching for changes\n"))
1227
1227
1228 unknown = []
1228 unknown = []
1229 for h in heads:
1229 for h in heads:
1230 if h not in m:
1230 if h not in m:
1231 unknown.append(h)
1231 unknown.append(h)
1232 else:
1232 else:
1233 base[h] = 1
1233 base[h] = 1
1234
1234
1235 heads = unknown
1235 heads = unknown
1236 if not unknown:
1236 if not unknown:
1237 return base.keys(), [], []
1237 return base.keys(), [], []
1238
1238
1239 req = set(unknown)
1239 req = set(unknown)
1240 reqcnt = 0
1240 reqcnt = 0
1241
1241
1242 # search through remote branches
1242 # search through remote branches
1243 # a 'branch' here is a linear segment of history, with four parts:
1243 # a 'branch' here is a linear segment of history, with four parts:
1244 # head, root, first parent, second parent
1244 # head, root, first parent, second parent
1245 # (a branch always has two parents (or none) by definition)
1245 # (a branch always has two parents (or none) by definition)
1246 unknown = remote.branches(unknown)
1246 unknown = remote.branches(unknown)
1247 while unknown:
1247 while unknown:
1248 r = []
1248 r = []
1249 while unknown:
1249 while unknown:
1250 n = unknown.pop(0)
1250 n = unknown.pop(0)
1251 if n[0] in seen:
1251 if n[0] in seen:
1252 continue
1252 continue
1253
1253
1254 self.ui.debug(_("examining %s:%s\n")
1254 self.ui.debug(_("examining %s:%s\n")
1255 % (short(n[0]), short(n[1])))
1255 % (short(n[0]), short(n[1])))
1256 if n[0] == nullid: # found the end of the branch
1256 if n[0] == nullid: # found the end of the branch
1257 pass
1257 pass
1258 elif n in seenbranch:
1258 elif n in seenbranch:
1259 self.ui.debug(_("branch already found\n"))
1259 self.ui.debug(_("branch already found\n"))
1260 continue
1260 continue
1261 elif n[1] and n[1] in m: # do we know the base?
1261 elif n[1] and n[1] in m: # do we know the base?
1262 self.ui.debug(_("found incomplete branch %s:%s\n")
1262 self.ui.debug(_("found incomplete branch %s:%s\n")
1263 % (short(n[0]), short(n[1])))
1263 % (short(n[0]), short(n[1])))
1264 search.append(n[0:2]) # schedule branch range for scanning
1264 search.append(n[0:2]) # schedule branch range for scanning
1265 seenbranch.add(n)
1265 seenbranch.add(n)
1266 else:
1266 else:
1267 if n[1] not in seen and n[1] not in fetch:
1267 if n[1] not in seen and n[1] not in fetch:
1268 if n[2] in m and n[3] in m:
1268 if n[2] in m and n[3] in m:
1269 self.ui.debug(_("found new changeset %s\n") %
1269 self.ui.debug(_("found new changeset %s\n") %
1270 short(n[1]))
1270 short(n[1]))
1271 fetch.add(n[1]) # earliest unknown
1271 fetch.add(n[1]) # earliest unknown
1272 for p in n[2:4]:
1272 for p in n[2:4]:
1273 if p in m:
1273 if p in m:
1274 base[p] = 1 # latest known
1274 base[p] = 1 # latest known
1275
1275
1276 for p in n[2:4]:
1276 for p in n[2:4]:
1277 if p not in req and p not in m:
1277 if p not in req and p not in m:
1278 r.append(p)
1278 r.append(p)
1279 req.add(p)
1279 req.add(p)
1280 seen.add(n[0])
1280 seen.add(n[0])
1281
1281
1282 if r:
1282 if r:
1283 reqcnt += 1
1283 reqcnt += 1
1284 self.ui.debug(_("request %d: %s\n") %
1284 self.ui.debug(_("request %d: %s\n") %
1285 (reqcnt, " ".join(map(short, r))))
1285 (reqcnt, " ".join(map(short, r))))
1286 for p in xrange(0, len(r), 10):
1286 for p in xrange(0, len(r), 10):
1287 for b in remote.branches(r[p:p+10]):
1287 for b in remote.branches(r[p:p+10]):
1288 self.ui.debug(_("received %s:%s\n") %
1288 self.ui.debug(_("received %s:%s\n") %
1289 (short(b[0]), short(b[1])))
1289 (short(b[0]), short(b[1])))
1290 unknown.append(b)
1290 unknown.append(b)
1291
1291
1292 # do binary search on the branches we found
1292 # do binary search on the branches we found
1293 while search:
1293 while search:
1294 newsearch = []
1294 newsearch = []
1295 reqcnt += 1
1295 reqcnt += 1
1296 for n, l in zip(search, remote.between(search)):
1296 for n, l in zip(search, remote.between(search)):
1297 l.append(n[1])
1297 l.append(n[1])
1298 p = n[0]
1298 p = n[0]
1299 f = 1
1299 f = 1
1300 for i in l:
1300 for i in l:
1301 self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i)))
1301 self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i)))
1302 if i in m:
1302 if i in m:
1303 if f <= 2:
1303 if f <= 2:
1304 self.ui.debug(_("found new branch changeset %s\n") %
1304 self.ui.debug(_("found new branch changeset %s\n") %
1305 short(p))
1305 short(p))
1306 fetch.add(p)
1306 fetch.add(p)
1307 base[i] = 1
1307 base[i] = 1
1308 else:
1308 else:
1309 self.ui.debug(_("narrowed branch search to %s:%s\n")
1309 self.ui.debug(_("narrowed branch search to %s:%s\n")
1310 % (short(p), short(i)))
1310 % (short(p), short(i)))
1311 newsearch.append((p, i))
1311 newsearch.append((p, i))
1312 break
1312 break
1313 p, f = i, f * 2
1313 p, f = i, f * 2
1314 search = newsearch
1314 search = newsearch
1315
1315
1316 # sanity check our fetch list
1316 # sanity check our fetch list
1317 for f in fetch:
1317 for f in fetch:
1318 if f in m:
1318 if f in m:
1319 raise error.RepoError(_("already have changeset ")
1319 raise error.RepoError(_("already have changeset ")
1320 + short(f[:4]))
1320 + short(f[:4]))
1321
1321
1322 if base.keys() == [nullid]:
1322 if base.keys() == [nullid]:
1323 if force:
1323 if force:
1324 self.ui.warn(_("warning: repository is unrelated\n"))
1324 self.ui.warn(_("warning: repository is unrelated\n"))
1325 else:
1325 else:
1326 raise util.Abort(_("repository is unrelated"))
1326 raise util.Abort(_("repository is unrelated"))
1327
1327
1328 self.ui.debug(_("found new changesets starting at ") +
1328 self.ui.debug(_("found new changesets starting at ") +
1329 " ".join([short(f) for f in fetch]) + "\n")
1329 " ".join([short(f) for f in fetch]) + "\n")
1330
1330
1331 self.ui.debug(_("%d total queries\n") % reqcnt)
1331 self.ui.debug(_("%d total queries\n") % reqcnt)
1332
1332
1333 return base.keys(), list(fetch), heads
1333 return base.keys(), list(fetch), heads
1334
1334
1335 def findoutgoing(self, remote, base=None, heads=None, force=False):
1335 def findoutgoing(self, remote, base=None, heads=None, force=False):
1336 """Return list of nodes that are roots of subsets not in remote
1336 """Return list of nodes that are roots of subsets not in remote
1337
1337
1338 If base dict is specified, assume that these nodes and their parents
1338 If base dict is specified, assume that these nodes and their parents
1339 exist on the remote side.
1339 exist on the remote side.
1340 If a list of heads is specified, return only nodes which are heads
1340 If a list of heads is specified, return only nodes which are heads
1341 or ancestors of these heads, and return a second element which
1341 or ancestors of these heads, and return a second element which
1342 contains all remote heads which get new children.
1342 contains all remote heads which get new children.
1343 """
1343 """
1344 if base is None:
1344 if base is None:
1345 base = {}
1345 base = {}
1346 self.findincoming(remote, base, heads, force=force)
1346 self.findincoming(remote, base, heads, force=force)
1347
1347
1348 self.ui.debug(_("common changesets up to ")
1348 self.ui.debug(_("common changesets up to ")
1349 + " ".join(map(short, base.keys())) + "\n")
1349 + " ".join(map(short, base.keys())) + "\n")
1350
1350
1351 remain = set(self.changelog.nodemap)
1351 remain = set(self.changelog.nodemap)
1352
1352
1353 # prune everything remote has from the tree
1353 # prune everything remote has from the tree
1354 remain.remove(nullid)
1354 remain.remove(nullid)
1355 remove = base.keys()
1355 remove = base.keys()
1356 while remove:
1356 while remove:
1357 n = remove.pop(0)
1357 n = remove.pop(0)
1358 if n in remain:
1358 if n in remain:
1359 remain.remove(n)
1359 remain.remove(n)
1360 for p in self.changelog.parents(n):
1360 for p in self.changelog.parents(n):
1361 remove.append(p)
1361 remove.append(p)
1362
1362
1363 # find every node whose parents have been pruned
1363 # find every node whose parents have been pruned
1364 subset = []
1364 subset = []
1365 # find every remote head that will get new children
1365 # find every remote head that will get new children
1366 updated_heads = set()
1366 updated_heads = set()
1367 for n in remain:
1367 for n in remain:
1368 p1, p2 = self.changelog.parents(n)
1368 p1, p2 = self.changelog.parents(n)
1369 if p1 not in remain and p2 not in remain:
1369 if p1 not in remain and p2 not in remain:
1370 subset.append(n)
1370 subset.append(n)
1371 if heads:
1371 if heads:
1372 if p1 in heads:
1372 if p1 in heads:
1373 updated_heads.add(p1)
1373 updated_heads.add(p1)
1374 if p2 in heads:
1374 if p2 in heads:
1375 updated_heads.add(p2)
1375 updated_heads.add(p2)
1376
1376
1377 # this is the set of all roots we have to push
1377 # this is the set of all roots we have to push
1378 if heads:
1378 if heads:
1379 return subset, list(updated_heads)
1379 return subset, list(updated_heads)
1380 else:
1380 else:
1381 return subset
1381 return subset
1382
1382
1383 def pull(self, remote, heads=None, force=False):
1383 def pull(self, remote, heads=None, force=False):
1384 lock = self.lock()
1384 lock = self.lock()
1385 try:
1385 try:
1386 common, fetch, rheads = self.findcommonincoming(remote, heads=heads,
1386 common, fetch, rheads = self.findcommonincoming(remote, heads=heads,
1387 force=force)
1387 force=force)
1388 if fetch == [nullid]:
1388 if fetch == [nullid]:
1389 self.ui.status(_("requesting all changes\n"))
1389 self.ui.status(_("requesting all changes\n"))
1390
1390
1391 if not fetch:
1391 if not fetch:
1392 self.ui.status(_("no changes found\n"))
1392 self.ui.status(_("no changes found\n"))
1393 return 0
1393 return 0
1394
1394
1395 if heads is None and remote.capable('changegroupsubset'):
1395 if heads is None and remote.capable('changegroupsubset'):
1396 heads = rheads
1396 heads = rheads
1397
1397
1398 if heads is None:
1398 if heads is None:
1399 cg = remote.changegroup(fetch, 'pull')
1399 cg = remote.changegroup(fetch, 'pull')
1400 else:
1400 else:
1401 if not remote.capable('changegroupsubset'):
1401 if not remote.capable('changegroupsubset'):
1402 raise util.Abort(_("Partial pull cannot be done because other repository doesn't support changegroupsubset."))
1402 raise util.Abort(_("Partial pull cannot be done because other repository doesn't support changegroupsubset."))
1403 cg = remote.changegroupsubset(fetch, heads, 'pull')
1403 cg = remote.changegroupsubset(fetch, heads, 'pull')
1404 return self.addchangegroup(cg, 'pull', remote.url())
1404 return self.addchangegroup(cg, 'pull', remote.url())
1405 finally:
1405 finally:
1406 lock.release()
1406 lock.release()
1407
1407
1408 def push(self, remote, force=False, revs=None):
1408 def push(self, remote, force=False, revs=None):
1409 # there are two ways to push to remote repo:
1409 # there are two ways to push to remote repo:
1410 #
1410 #
1411 # addchangegroup assumes local user can lock remote
1411 # addchangegroup assumes local user can lock remote
1412 # repo (local filesystem, old ssh servers).
1412 # repo (local filesystem, old ssh servers).
1413 #
1413 #
1414 # unbundle assumes local user cannot lock remote repo (new ssh
1414 # unbundle assumes local user cannot lock remote repo (new ssh
1415 # servers, http servers).
1415 # servers, http servers).
1416
1416
1417 if remote.capable('unbundle'):
1417 if remote.capable('unbundle'):
1418 return self.push_unbundle(remote, force, revs)
1418 return self.push_unbundle(remote, force, revs)
1419 return self.push_addchangegroup(remote, force, revs)
1419 return self.push_addchangegroup(remote, force, revs)
1420
1420
1421 def prepush(self, remote, force, revs):
1421 def prepush(self, remote, force, revs):
1422 common = {}
1422 common = {}
1423 remote_heads = remote.heads()
1423 remote_heads = remote.heads()
1424 inc = self.findincoming(remote, common, remote_heads, force=force)
1424 inc = self.findincoming(remote, common, remote_heads, force=force)
1425
1425
1426 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1426 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1427 if revs is not None:
1427 if revs is not None:
1428 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1428 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1429 else:
1429 else:
1430 bases, heads = update, self.changelog.heads()
1430 bases, heads = update, self.changelog.heads()
1431
1431
1432 if not bases:
1432 if not bases:
1433 self.ui.status(_("no changes found\n"))
1433 self.ui.status(_("no changes found\n"))
1434 return None, 1
1434 return None, 1
1435 elif not force:
1435 elif not force:
1436 # check if we're creating new remote heads
1436 # check if we're creating new remote heads
1437 # to be a remote head after push, node must be either
1437 # to be a remote head after push, node must be either
1438 # - unknown locally
1438 # - unknown locally
1439 # - a local outgoing head descended from update
1439 # - a local outgoing head descended from update
1440 # - a remote head that's known locally and not
1440 # - a remote head that's known locally and not
1441 # ancestral to an outgoing head
1441 # ancestral to an outgoing head
1442
1442
1443 warn = 0
1443 warn = 0
1444
1444
1445 if remote_heads == [nullid]:
1445 if remote_heads == [nullid]:
1446 warn = 0
1446 warn = 0
1447 elif not revs and len(heads) > len(remote_heads):
1447 elif not revs and len(heads) > len(remote_heads):
1448 warn = 1
1448 warn = 1
1449 else:
1449 else:
1450 newheads = list(heads)
1450 newheads = list(heads)
1451 for r in remote_heads:
1451 for r in remote_heads:
1452 if r in self.changelog.nodemap:
1452 if r in self.changelog.nodemap:
1453 desc = self.changelog.heads(r, heads)
1453 desc = self.changelog.heads(r, heads)
1454 l = [h for h in heads if h in desc]
1454 l = [h for h in heads if h in desc]
1455 if not l:
1455 if not l:
1456 newheads.append(r)
1456 newheads.append(r)
1457 else:
1457 else:
1458 newheads.append(r)
1458 newheads.append(r)
1459 if len(newheads) > len(remote_heads):
1459 if len(newheads) > len(remote_heads):
1460 warn = 1
1460 warn = 1
1461
1461
1462 if warn:
1462 if warn:
1463 self.ui.warn(_("abort: push creates new remote heads!\n"))
1463 self.ui.warn(_("abort: push creates new remote heads!\n"))
1464 self.ui.status(_("(did you forget to merge?"
1464 self.ui.status(_("(did you forget to merge?"
1465 " use push -f to force)\n"))
1465 " use push -f to force)\n"))
1466 return None, 0
1466 return None, 0
1467 elif inc:
1467 elif inc:
1468 self.ui.warn(_("note: unsynced remote changes!\n"))
1468 self.ui.warn(_("note: unsynced remote changes!\n"))
1469
1469
1470
1470
1471 if revs is None:
1471 if revs is None:
1472 # use the fast path, no race possible on push
1472 # use the fast path, no race possible on push
1473 cg = self._changegroup(common.keys(), 'push')
1473 cg = self._changegroup(common.keys(), 'push')
1474 else:
1474 else:
1475 cg = self.changegroupsubset(update, revs, 'push')
1475 cg = self.changegroupsubset(update, revs, 'push')
1476 return cg, remote_heads
1476 return cg, remote_heads
1477
1477
1478 def push_addchangegroup(self, remote, force, revs):
1478 def push_addchangegroup(self, remote, force, revs):
1479 lock = remote.lock()
1479 lock = remote.lock()
1480 try:
1480 try:
1481 ret = self.prepush(remote, force, revs)
1481 ret = self.prepush(remote, force, revs)
1482 if ret[0] is not None:
1482 if ret[0] is not None:
1483 cg, remote_heads = ret
1483 cg, remote_heads = ret
1484 return remote.addchangegroup(cg, 'push', self.url())
1484 return remote.addchangegroup(cg, 'push', self.url())
1485 return ret[1]
1485 return ret[1]
1486 finally:
1486 finally:
1487 lock.release()
1487 lock.release()
1488
1488
1489 def push_unbundle(self, remote, force, revs):
1489 def push_unbundle(self, remote, force, revs):
1490 # local repo finds heads on server, finds out what revs it
1490 # local repo finds heads on server, finds out what revs it
1491 # must push. once revs transferred, if server finds it has
1491 # must push. once revs transferred, if server finds it has
1492 # different heads (someone else won commit/push race), server
1492 # different heads (someone else won commit/push race), server
1493 # aborts.
1493 # aborts.
1494
1494
1495 ret = self.prepush(remote, force, revs)
1495 ret = self.prepush(remote, force, revs)
1496 if ret[0] is not None:
1496 if ret[0] is not None:
1497 cg, remote_heads = ret
1497 cg, remote_heads = ret
1498 if force: remote_heads = ['force']
1498 if force: remote_heads = ['force']
1499 return remote.unbundle(cg, remote_heads, 'push')
1499 return remote.unbundle(cg, remote_heads, 'push')
1500 return ret[1]
1500 return ret[1]
1501
1501
1502 def changegroupinfo(self, nodes, source):
1502 def changegroupinfo(self, nodes, source):
1503 if self.ui.verbose or source == 'bundle':
1503 if self.ui.verbose or source == 'bundle':
1504 self.ui.status(_("%d changesets found\n") % len(nodes))
1504 self.ui.status(_("%d changesets found\n") % len(nodes))
1505 if self.ui.debugflag:
1505 if self.ui.debugflag:
1506 self.ui.debug(_("list of changesets:\n"))
1506 self.ui.debug(_("list of changesets:\n"))
1507 for node in nodes:
1507 for node in nodes:
1508 self.ui.debug("%s\n" % hex(node))
1508 self.ui.debug("%s\n" % hex(node))
1509
1509
1510 def changegroupsubset(self, bases, heads, source, extranodes=None):
1510 def changegroupsubset(self, bases, heads, source, extranodes=None):
1511 """This function generates a changegroup consisting of all the nodes
1511 """This function generates a changegroup consisting of all the nodes
1512 that are descendents of any of the bases, and ancestors of any of
1512 that are descendents of any of the bases, and ancestors of any of
1513 the heads.
1513 the heads.
1514
1514
1515 It is fairly complex as determining which filenodes and which
1515 It is fairly complex as determining which filenodes and which
1516 manifest nodes need to be included for the changeset to be complete
1516 manifest nodes need to be included for the changeset to be complete
1517 is non-trivial.
1517 is non-trivial.
1518
1518
1519 Another wrinkle is doing the reverse, figuring out which changeset in
1519 Another wrinkle is doing the reverse, figuring out which changeset in
1520 the changegroup a particular filenode or manifestnode belongs to.
1520 the changegroup a particular filenode or manifestnode belongs to.
1521
1521
1522 The caller can specify some nodes that must be included in the
1522 The caller can specify some nodes that must be included in the
1523 changegroup using the extranodes argument. It should be a dict
1523 changegroup using the extranodes argument. It should be a dict
1524 where the keys are the filenames (or 1 for the manifest), and the
1524 where the keys are the filenames (or 1 for the manifest), and the
1525 values are lists of (node, linknode) tuples, where node is a wanted
1525 values are lists of (node, linknode) tuples, where node is a wanted
1526 node and linknode is the changelog node that should be transmitted as
1526 node and linknode is the changelog node that should be transmitted as
1527 the linkrev.
1527 the linkrev.
1528 """
1528 """
1529
1529
1530 if extranodes is None:
1530 if extranodes is None:
1531 # can we go through the fast path ?
1531 # can we go through the fast path ?
1532 heads.sort()
1532 heads.sort()
1533 allheads = self.heads()
1533 allheads = self.heads()
1534 allheads.sort()
1534 allheads.sort()
1535 if heads == allheads:
1535 if heads == allheads:
1536 common = []
1536 common = []
1537 # parents of bases are known from both sides
1537 # parents of bases are known from both sides
1538 for n in bases:
1538 for n in bases:
1539 for p in self.changelog.parents(n):
1539 for p in self.changelog.parents(n):
1540 if p != nullid:
1540 if p != nullid:
1541 common.append(p)
1541 common.append(p)
1542 return self._changegroup(common, source)
1542 return self._changegroup(common, source)
1543
1543
1544 self.hook('preoutgoing', throw=True, source=source)
1544 self.hook('preoutgoing', throw=True, source=source)
1545
1545
1546 # Set up some initial variables
1546 # Set up some initial variables
1547 # Make it easy to refer to self.changelog
1547 # Make it easy to refer to self.changelog
1548 cl = self.changelog
1548 cl = self.changelog
1549 # msng is short for missing - compute the list of changesets in this
1549 # msng is short for missing - compute the list of changesets in this
1550 # changegroup.
1550 # changegroup.
1551 msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads)
1551 msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads)
1552 self.changegroupinfo(msng_cl_lst, source)
1552 self.changegroupinfo(msng_cl_lst, source)
1553 # Some bases may turn out to be superfluous, and some heads may be
1553 # Some bases may turn out to be superfluous, and some heads may be
1554 # too. nodesbetween will return the minimal set of bases and heads
1554 # too. nodesbetween will return the minimal set of bases and heads
1555 # necessary to re-create the changegroup.
1555 # necessary to re-create the changegroup.
1556
1556
1557 # Known heads are the list of heads that it is assumed the recipient
1557 # Known heads are the list of heads that it is assumed the recipient
1558 # of this changegroup will know about.
1558 # of this changegroup will know about.
1559 knownheads = set()
1559 knownheads = set()
1560 # We assume that all parents of bases are known heads.
1560 # We assume that all parents of bases are known heads.
1561 for n in bases:
1561 for n in bases:
1562 knownheads.update(cl.parents(n))
1562 knownheads.update(cl.parents(n))
1563 knownheads.discard(nullid)
1563 knownheads.discard(nullid)
1564 knownheads = list(knownheads)
1564 knownheads = list(knownheads)
1565 if knownheads:
1565 if knownheads:
1566 # Now that we know what heads are known, we can compute which
1566 # Now that we know what heads are known, we can compute which
1567 # changesets are known. The recipient must know about all
1567 # changesets are known. The recipient must know about all
1568 # changesets required to reach the known heads from the null
1568 # changesets required to reach the known heads from the null
1569 # changeset.
1569 # changeset.
1570 has_cl_set, junk, junk = cl.nodesbetween(None, knownheads)
1570 has_cl_set, junk, junk = cl.nodesbetween(None, knownheads)
1571 junk = None
1571 junk = None
1572 # Transform the list into a set.
1572 # Transform the list into a set.
1573 has_cl_set = set(has_cl_set)
1573 has_cl_set = set(has_cl_set)
1574 else:
1574 else:
1575 # If there were no known heads, the recipient cannot be assumed to
1575 # If there were no known heads, the recipient cannot be assumed to
1576 # know about any changesets.
1576 # know about any changesets.
1577 has_cl_set = set()
1577 has_cl_set = set()
1578
1578
1579 # Make it easy to refer to self.manifest
1579 # Make it easy to refer to self.manifest
1580 mnfst = self.manifest
1580 mnfst = self.manifest
1581 # We don't know which manifests are missing yet
1581 # We don't know which manifests are missing yet
1582 msng_mnfst_set = {}
1582 msng_mnfst_set = {}
1583 # Nor do we know which filenodes are missing.
1583 # Nor do we know which filenodes are missing.
1584 msng_filenode_set = {}
1584 msng_filenode_set = {}
1585
1585
1586 junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex
1586 junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex
1587 junk = None
1587 junk = None
1588
1588
1589 # A changeset always belongs to itself, so the changenode lookup
1589 # A changeset always belongs to itself, so the changenode lookup
1590 # function for a changenode is identity.
1590 # function for a changenode is identity.
1591 def identity(x):
1591 def identity(x):
1592 return x
1592 return x
1593
1593
1594 # A function generating function. Sets up an environment for the
1594 # A function generating function. Sets up an environment for the
1595 # inner function.
1595 # inner function.
1596 def cmp_by_rev_func(revlog):
1596 def cmp_by_rev_func(revlog):
1597 # Compare two nodes by their revision number in the environment's
1597 # Compare two nodes by their revision number in the environment's
1598 # revision history. Since the revision number both represents the
1598 # revision history. Since the revision number both represents the
1599 # most efficient order to read the nodes in, and represents a
1599 # most efficient order to read the nodes in, and represents a
1600 # topological sorting of the nodes, this function is often useful.
1600 # topological sorting of the nodes, this function is often useful.
1601 def cmp_by_rev(a, b):
1601 def cmp_by_rev(a, b):
1602 return cmp(revlog.rev(a), revlog.rev(b))
1602 return cmp(revlog.rev(a), revlog.rev(b))
1603 return cmp_by_rev
1603 return cmp_by_rev
1604
1604
1605 # If we determine that a particular file or manifest node must be a
1605 # If we determine that a particular file or manifest node must be a
1606 # node that the recipient of the changegroup will already have, we can
1606 # node that the recipient of the changegroup will already have, we can
1607 # also assume the recipient will have all the parents. This function
1607 # also assume the recipient will have all the parents. This function
1608 # prunes them from the set of missing nodes.
1608 # prunes them from the set of missing nodes.
1609 def prune_parents(revlog, hasset, msngset):
1609 def prune_parents(revlog, hasset, msngset):
1610 haslst = list(hasset)
1610 haslst = list(hasset)
1611 haslst.sort(cmp_by_rev_func(revlog))
1611 haslst.sort(cmp_by_rev_func(revlog))
1612 for node in haslst:
1612 for node in haslst:
1613 parentlst = [p for p in revlog.parents(node) if p != nullid]
1613 parentlst = [p for p in revlog.parents(node) if p != nullid]
1614 while parentlst:
1614 while parentlst:
1615 n = parentlst.pop()
1615 n = parentlst.pop()
1616 if n not in hasset:
1616 if n not in hasset:
1617 hasset.add(n)
1617 hasset.add(n)
1618 p = [p for p in revlog.parents(n) if p != nullid]
1618 p = [p for p in revlog.parents(n) if p != nullid]
1619 parentlst.extend(p)
1619 parentlst.extend(p)
1620 for n in hasset:
1620 for n in hasset:
1621 msngset.pop(n, None)
1621 msngset.pop(n, None)
1622
1622
1623 # This is a function generating function used to set up an environment
1623 # This is a function generating function used to set up an environment
1624 # for the inner function to execute in.
1624 # for the inner function to execute in.
1625 def manifest_and_file_collector(changedfileset):
1625 def manifest_and_file_collector(changedfileset):
1626 # This is an information gathering function that gathers
1626 # This is an information gathering function that gathers
1627 # information from each changeset node that goes out as part of
1627 # information from each changeset node that goes out as part of
1628 # the changegroup. The information gathered is a list of which
1628 # the changegroup. The information gathered is a list of which
1629 # manifest nodes are potentially required (the recipient may
1629 # manifest nodes are potentially required (the recipient may
1630 # already have them) and total list of all files which were
1630 # already have them) and total list of all files which were
1631 # changed in any changeset in the changegroup.
1631 # changed in any changeset in the changegroup.
1632 #
1632 #
1633 # We also remember the first changenode we saw any manifest
1633 # We also remember the first changenode we saw any manifest
1634 # referenced by so we can later determine which changenode 'owns'
1634 # referenced by so we can later determine which changenode 'owns'
1635 # the manifest.
1635 # the manifest.
1636 def collect_manifests_and_files(clnode):
1636 def collect_manifests_and_files(clnode):
1637 c = cl.read(clnode)
1637 c = cl.read(clnode)
1638 for f in c[3]:
1638 for f in c[3]:
1639 # This is to make sure we only have one instance of each
1639 # This is to make sure we only have one instance of each
1640 # filename string for each filename.
1640 # filename string for each filename.
1641 changedfileset.setdefault(f, f)
1641 changedfileset.setdefault(f, f)
1642 msng_mnfst_set.setdefault(c[0], clnode)
1642 msng_mnfst_set.setdefault(c[0], clnode)
1643 return collect_manifests_and_files
1643 return collect_manifests_and_files
1644
1644
1645 # Figure out which manifest nodes (of the ones we think might be part
1645 # Figure out which manifest nodes (of the ones we think might be part
1646 # of the changegroup) the recipient must know about and remove them
1646 # of the changegroup) the recipient must know about and remove them
1647 # from the changegroup.
1647 # from the changegroup.
1648 def prune_manifests():
1648 def prune_manifests():
1649 has_mnfst_set = set()
1649 has_mnfst_set = set()
1650 for n in msng_mnfst_set:
1650 for n in msng_mnfst_set:
1651 # If a 'missing' manifest thinks it belongs to a changenode
1651 # If a 'missing' manifest thinks it belongs to a changenode
1652 # the recipient is assumed to have, obviously the recipient
1652 # the recipient is assumed to have, obviously the recipient
1653 # must have that manifest.
1653 # must have that manifest.
1654 linknode = cl.node(mnfst.linkrev(mnfst.rev(n)))
1654 linknode = cl.node(mnfst.linkrev(mnfst.rev(n)))
1655 if linknode in has_cl_set:
1655 if linknode in has_cl_set:
1656 has_mnfst_set.add(n)
1656 has_mnfst_set.add(n)
1657 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set)
1657 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set)
1658
1658
1659 # Use the information collected in collect_manifests_and_files to say
1659 # Use the information collected in collect_manifests_and_files to say
1660 # which changenode any manifestnode belongs to.
1660 # which changenode any manifestnode belongs to.
1661 def lookup_manifest_link(mnfstnode):
1661 def lookup_manifest_link(mnfstnode):
1662 return msng_mnfst_set[mnfstnode]
1662 return msng_mnfst_set[mnfstnode]
1663
1663
1664 # A function generating function that sets up the initial environment
1664 # A function generating function that sets up the initial environment
1665 # the inner function.
1665 # the inner function.
1666 def filenode_collector(changedfiles):
1666 def filenode_collector(changedfiles):
1667 next_rev = [0]
1667 next_rev = [0]
1668 # This gathers information from each manifestnode included in the
1668 # This gathers information from each manifestnode included in the
1669 # changegroup about which filenodes the manifest node references
1669 # changegroup about which filenodes the manifest node references
1670 # so we can include those in the changegroup too.
1670 # so we can include those in the changegroup too.
1671 #
1671 #
1672 # It also remembers which changenode each filenode belongs to. It
1672 # It also remembers which changenode each filenode belongs to. It
1673 # does this by assuming the a filenode belongs to the changenode
1673 # does this by assuming the a filenode belongs to the changenode
1674 # the first manifest that references it belongs to.
1674 # the first manifest that references it belongs to.
1675 def collect_msng_filenodes(mnfstnode):
1675 def collect_msng_filenodes(mnfstnode):
1676 r = mnfst.rev(mnfstnode)
1676 r = mnfst.rev(mnfstnode)
1677 if r == next_rev[0]:
1677 if r == next_rev[0]:
1678 # If the last rev we looked at was the one just previous,
1678 # If the last rev we looked at was the one just previous,
1679 # we only need to see a diff.
1679 # we only need to see a diff.
1680 deltamf = mnfst.readdelta(mnfstnode)
1680 deltamf = mnfst.readdelta(mnfstnode)
1681 # For each line in the delta
1681 # For each line in the delta
1682 for f, fnode in deltamf.iteritems():
1682 for f, fnode in deltamf.iteritems():
1683 f = changedfiles.get(f, None)
1683 f = changedfiles.get(f, None)
1684 # And if the file is in the list of files we care
1684 # And if the file is in the list of files we care
1685 # about.
1685 # about.
1686 if f is not None:
1686 if f is not None:
1687 # Get the changenode this manifest belongs to
1687 # Get the changenode this manifest belongs to
1688 clnode = msng_mnfst_set[mnfstnode]
1688 clnode = msng_mnfst_set[mnfstnode]
1689 # Create the set of filenodes for the file if
1689 # Create the set of filenodes for the file if
1690 # there isn't one already.
1690 # there isn't one already.
1691 ndset = msng_filenode_set.setdefault(f, {})
1691 ndset = msng_filenode_set.setdefault(f, {})
1692 # And set the filenode's changelog node to the
1692 # And set the filenode's changelog node to the
1693 # manifest's if it hasn't been set already.
1693 # manifest's if it hasn't been set already.
1694 ndset.setdefault(fnode, clnode)
1694 ndset.setdefault(fnode, clnode)
1695 else:
1695 else:
1696 # Otherwise we need a full manifest.
1696 # Otherwise we need a full manifest.
1697 m = mnfst.read(mnfstnode)
1697 m = mnfst.read(mnfstnode)
1698 # For every file in we care about.
1698 # For every file in we care about.
1699 for f in changedfiles:
1699 for f in changedfiles:
1700 fnode = m.get(f, None)
1700 fnode = m.get(f, None)
1701 # If it's in the manifest
1701 # If it's in the manifest
1702 if fnode is not None:
1702 if fnode is not None:
1703 # See comments above.
1703 # See comments above.
1704 clnode = msng_mnfst_set[mnfstnode]
1704 clnode = msng_mnfst_set[mnfstnode]
1705 ndset = msng_filenode_set.setdefault(f, {})
1705 ndset = msng_filenode_set.setdefault(f, {})
1706 ndset.setdefault(fnode, clnode)
1706 ndset.setdefault(fnode, clnode)
1707 # Remember the revision we hope to see next.
1707 # Remember the revision we hope to see next.
1708 next_rev[0] = r + 1
1708 next_rev[0] = r + 1
1709 return collect_msng_filenodes
1709 return collect_msng_filenodes
1710
1710
1711 # We have a list of filenodes we think we need for a file, lets remove
1711 # We have a list of filenodes we think we need for a file, lets remove
1712 # all those we know the recipient must have.
1712 # all those we know the recipient must have.
1713 def prune_filenodes(f, filerevlog):
1713 def prune_filenodes(f, filerevlog):
1714 msngset = msng_filenode_set[f]
1714 msngset = msng_filenode_set[f]
1715 hasset = set()
1715 hasset = set()
1716 # If a 'missing' filenode thinks it belongs to a changenode we
1716 # If a 'missing' filenode thinks it belongs to a changenode we
1717 # assume the recipient must have, then the recipient must have
1717 # assume the recipient must have, then the recipient must have
1718 # that filenode.
1718 # that filenode.
1719 for n in msngset:
1719 for n in msngset:
1720 clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n)))
1720 clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n)))
1721 if clnode in has_cl_set:
1721 if clnode in has_cl_set:
1722 hasset.add(n)
1722 hasset.add(n)
1723 prune_parents(filerevlog, hasset, msngset)
1723 prune_parents(filerevlog, hasset, msngset)
1724
1724
1725 # A function generator function that sets up the a context for the
1725 # A function generator function that sets up the a context for the
1726 # inner function.
1726 # inner function.
1727 def lookup_filenode_link_func(fname):
1727 def lookup_filenode_link_func(fname):
1728 msngset = msng_filenode_set[fname]
1728 msngset = msng_filenode_set[fname]
1729 # Lookup the changenode the filenode belongs to.
1729 # Lookup the changenode the filenode belongs to.
1730 def lookup_filenode_link(fnode):
1730 def lookup_filenode_link(fnode):
1731 return msngset[fnode]
1731 return msngset[fnode]
1732 return lookup_filenode_link
1732 return lookup_filenode_link
1733
1733
1734 # Add the nodes that were explicitly requested.
1734 # Add the nodes that were explicitly requested.
1735 def add_extra_nodes(name, nodes):
1735 def add_extra_nodes(name, nodes):
1736 if not extranodes or name not in extranodes:
1736 if not extranodes or name not in extranodes:
1737 return
1737 return
1738
1738
1739 for node, linknode in extranodes[name]:
1739 for node, linknode in extranodes[name]:
1740 if node not in nodes:
1740 if node not in nodes:
1741 nodes[node] = linknode
1741 nodes[node] = linknode
1742
1742
1743 # Now that we have all theses utility functions to help out and
1743 # Now that we have all theses utility functions to help out and
1744 # logically divide up the task, generate the group.
1744 # logically divide up the task, generate the group.
1745 def gengroup():
1745 def gengroup():
1746 # The set of changed files starts empty.
1746 # The set of changed files starts empty.
1747 changedfiles = {}
1747 changedfiles = {}
1748 # Create a changenode group generator that will call our functions
1748 # Create a changenode group generator that will call our functions
1749 # back to lookup the owning changenode and collect information.
1749 # back to lookup the owning changenode and collect information.
1750 group = cl.group(msng_cl_lst, identity,
1750 group = cl.group(msng_cl_lst, identity,
1751 manifest_and_file_collector(changedfiles))
1751 manifest_and_file_collector(changedfiles))
1752 for chnk in group:
1752 for chnk in group:
1753 yield chnk
1753 yield chnk
1754
1754
1755 # The list of manifests has been collected by the generator
1755 # The list of manifests has been collected by the generator
1756 # calling our functions back.
1756 # calling our functions back.
1757 prune_manifests()
1757 prune_manifests()
1758 add_extra_nodes(1, msng_mnfst_set)
1758 add_extra_nodes(1, msng_mnfst_set)
1759 msng_mnfst_lst = msng_mnfst_set.keys()
1759 msng_mnfst_lst = msng_mnfst_set.keys()
1760 # Sort the manifestnodes by revision number.
1760 # Sort the manifestnodes by revision number.
1761 msng_mnfst_lst.sort(cmp_by_rev_func(mnfst))
1761 msng_mnfst_lst.sort(cmp_by_rev_func(mnfst))
1762 # Create a generator for the manifestnodes that calls our lookup
1762 # Create a generator for the manifestnodes that calls our lookup
1763 # and data collection functions back.
1763 # and data collection functions back.
1764 group = mnfst.group(msng_mnfst_lst, lookup_manifest_link,
1764 group = mnfst.group(msng_mnfst_lst, lookup_manifest_link,
1765 filenode_collector(changedfiles))
1765 filenode_collector(changedfiles))
1766 for chnk in group:
1766 for chnk in group:
1767 yield chnk
1767 yield chnk
1768
1768
1769 # These are no longer needed, dereference and toss the memory for
1769 # These are no longer needed, dereference and toss the memory for
1770 # them.
1770 # them.
1771 msng_mnfst_lst = None
1771 msng_mnfst_lst = None
1772 msng_mnfst_set.clear()
1772 msng_mnfst_set.clear()
1773
1773
1774 if extranodes:
1774 if extranodes:
1775 for fname in extranodes:
1775 for fname in extranodes:
1776 if isinstance(fname, int):
1776 if isinstance(fname, int):
1777 continue
1777 continue
1778 msng_filenode_set.setdefault(fname, {})
1778 msng_filenode_set.setdefault(fname, {})
1779 changedfiles[fname] = 1
1779 changedfiles[fname] = 1
1780 # Go through all our files in order sorted by name.
1780 # Go through all our files in order sorted by name.
1781 for fname in sorted(changedfiles):
1781 for fname in sorted(changedfiles):
1782 filerevlog = self.file(fname)
1782 filerevlog = self.file(fname)
1783 if not len(filerevlog):
1783 if not len(filerevlog):
1784 raise util.Abort(_("empty or missing revlog for %s") % fname)
1784 raise util.Abort(_("empty or missing revlog for %s") % fname)
1785 # Toss out the filenodes that the recipient isn't really
1785 # Toss out the filenodes that the recipient isn't really
1786 # missing.
1786 # missing.
1787 if fname in msng_filenode_set:
1787 if fname in msng_filenode_set:
1788 prune_filenodes(fname, filerevlog)
1788 prune_filenodes(fname, filerevlog)
1789 add_extra_nodes(fname, msng_filenode_set[fname])
1789 add_extra_nodes(fname, msng_filenode_set[fname])
1790 msng_filenode_lst = msng_filenode_set[fname].keys()
1790 msng_filenode_lst = msng_filenode_set[fname].keys()
1791 else:
1791 else:
1792 msng_filenode_lst = []
1792 msng_filenode_lst = []
1793 # If any filenodes are left, generate the group for them,
1793 # If any filenodes are left, generate the group for them,
1794 # otherwise don't bother.
1794 # otherwise don't bother.
1795 if len(msng_filenode_lst) > 0:
1795 if len(msng_filenode_lst) > 0:
1796 yield changegroup.chunkheader(len(fname))
1796 yield changegroup.chunkheader(len(fname))
1797 yield fname
1797 yield fname
1798 # Sort the filenodes by their revision #
1798 # Sort the filenodes by their revision #
1799 msng_filenode_lst.sort(cmp_by_rev_func(filerevlog))
1799 msng_filenode_lst.sort(cmp_by_rev_func(filerevlog))
1800 # Create a group generator and only pass in a changenode
1800 # Create a group generator and only pass in a changenode
1801 # lookup function as we need to collect no information
1801 # lookup function as we need to collect no information
1802 # from filenodes.
1802 # from filenodes.
1803 group = filerevlog.group(msng_filenode_lst,
1803 group = filerevlog.group(msng_filenode_lst,
1804 lookup_filenode_link_func(fname))
1804 lookup_filenode_link_func(fname))
1805 for chnk in group:
1805 for chnk in group:
1806 yield chnk
1806 yield chnk
1807 if fname in msng_filenode_set:
1807 if fname in msng_filenode_set:
1808 # Don't need this anymore, toss it to free memory.
1808 # Don't need this anymore, toss it to free memory.
1809 del msng_filenode_set[fname]
1809 del msng_filenode_set[fname]
1810 # Signal that no more groups are left.
1810 # Signal that no more groups are left.
1811 yield changegroup.closechunk()
1811 yield changegroup.closechunk()
1812
1812
1813 if msng_cl_lst:
1813 if msng_cl_lst:
1814 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
1814 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
1815
1815
1816 return util.chunkbuffer(gengroup())
1816 return util.chunkbuffer(gengroup())
1817
1817
1818 def changegroup(self, basenodes, source):
1818 def changegroup(self, basenodes, source):
1819 # to avoid a race we use changegroupsubset() (issue1320)
1819 # to avoid a race we use changegroupsubset() (issue1320)
1820 return self.changegroupsubset(basenodes, self.heads(), source)
1820 return self.changegroupsubset(basenodes, self.heads(), source)
1821
1821
1822 def _changegroup(self, common, source):
1822 def _changegroup(self, common, source):
1823 """Generate a changegroup of all nodes that we have that a recipient
1823 """Generate a changegroup of all nodes that we have that a recipient
1824 doesn't.
1824 doesn't.
1825
1825
1826 This is much easier than the previous function as we can assume that
1826 This is much easier than the previous function as we can assume that
1827 the recipient has any changenode we aren't sending them.
1827 the recipient has any changenode we aren't sending them.
1828
1828
1829 common is the set of common nodes between remote and self"""
1829 common is the set of common nodes between remote and self"""
1830
1830
1831 self.hook('preoutgoing', throw=True, source=source)
1831 self.hook('preoutgoing', throw=True, source=source)
1832
1832
1833 cl = self.changelog
1833 cl = self.changelog
1834 nodes = cl.findmissing(common)
1834 nodes = cl.findmissing(common)
1835 revset = set([cl.rev(n) for n in nodes])
1835 revset = set([cl.rev(n) for n in nodes])
1836 self.changegroupinfo(nodes, source)
1836 self.changegroupinfo(nodes, source)
1837
1837
1838 def identity(x):
1838 def identity(x):
1839 return x
1839 return x
1840
1840
1841 def gennodelst(log):
1841 def gennodelst(log):
1842 for r in log:
1842 for r in log:
1843 if log.linkrev(r) in revset:
1843 if log.linkrev(r) in revset:
1844 yield log.node(r)
1844 yield log.node(r)
1845
1845
1846 def changed_file_collector(changedfileset):
1846 def changed_file_collector(changedfileset):
1847 def collect_changed_files(clnode):
1847 def collect_changed_files(clnode):
1848 c = cl.read(clnode)
1848 c = cl.read(clnode)
1849 changedfileset.update(c[3])
1849 changedfileset.update(c[3])
1850 return collect_changed_files
1850 return collect_changed_files
1851
1851
1852 def lookuprevlink_func(revlog):
1852 def lookuprevlink_func(revlog):
1853 def lookuprevlink(n):
1853 def lookuprevlink(n):
1854 return cl.node(revlog.linkrev(revlog.rev(n)))
1854 return cl.node(revlog.linkrev(revlog.rev(n)))
1855 return lookuprevlink
1855 return lookuprevlink
1856
1856
1857 def gengroup():
1857 def gengroup():
1858 # construct a list of all changed files
1858 # construct a list of all changed files
1859 changedfiles = set()
1859 changedfiles = set()
1860
1860
1861 for chnk in cl.group(nodes, identity,
1861 for chnk in cl.group(nodes, identity,
1862 changed_file_collector(changedfiles)):
1862 changed_file_collector(changedfiles)):
1863 yield chnk
1863 yield chnk
1864
1864
1865 mnfst = self.manifest
1865 mnfst = self.manifest
1866 nodeiter = gennodelst(mnfst)
1866 nodeiter = gennodelst(mnfst)
1867 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
1867 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
1868 yield chnk
1868 yield chnk
1869
1869
1870 for fname in sorted(changedfiles):
1870 for fname in sorted(changedfiles):
1871 filerevlog = self.file(fname)
1871 filerevlog = self.file(fname)
1872 if not len(filerevlog):
1872 if not len(filerevlog):
1873 raise util.Abort(_("empty or missing revlog for %s") % fname)
1873 raise util.Abort(_("empty or missing revlog for %s") % fname)
1874 nodeiter = gennodelst(filerevlog)
1874 nodeiter = gennodelst(filerevlog)
1875 nodeiter = list(nodeiter)
1875 nodeiter = list(nodeiter)
1876 if nodeiter:
1876 if nodeiter:
1877 yield changegroup.chunkheader(len(fname))
1877 yield changegroup.chunkheader(len(fname))
1878 yield fname
1878 yield fname
1879 lookup = lookuprevlink_func(filerevlog)
1879 lookup = lookuprevlink_func(filerevlog)
1880 for chnk in filerevlog.group(nodeiter, lookup):
1880 for chnk in filerevlog.group(nodeiter, lookup):
1881 yield chnk
1881 yield chnk
1882
1882
1883 yield changegroup.closechunk()
1883 yield changegroup.closechunk()
1884
1884
1885 if nodes:
1885 if nodes:
1886 self.hook('outgoing', node=hex(nodes[0]), source=source)
1886 self.hook('outgoing', node=hex(nodes[0]), source=source)
1887
1887
1888 return util.chunkbuffer(gengroup())
1888 return util.chunkbuffer(gengroup())
1889
1889
1890 def addchangegroup(self, source, srctype, url, emptyok=False):
1890 def addchangegroup(self, source, srctype, url, emptyok=False):
1891 """add changegroup to repo.
1891 """add changegroup to repo.
1892
1892
1893 return values:
1893 return values:
1894 - nothing changed or no source: 0
1894 - nothing changed or no source: 0
1895 - more heads than before: 1+added heads (2..n)
1895 - more heads than before: 1+added heads (2..n)
1896 - less heads than before: -1-removed heads (-2..-n)
1896 - less heads than before: -1-removed heads (-2..-n)
1897 - number of heads stays the same: 1
1897 - number of heads stays the same: 1
1898 """
1898 """
1899 def csmap(x):
1899 def csmap(x):
1900 self.ui.debug(_("add changeset %s\n") % short(x))
1900 self.ui.debug(_("add changeset %s\n") % short(x))
1901 return len(cl)
1901 return len(cl)
1902
1902
1903 def revmap(x):
1903 def revmap(x):
1904 return cl.rev(x)
1904 return cl.rev(x)
1905
1905
1906 if not source:
1906 if not source:
1907 return 0
1907 return 0
1908
1908
1909 self.hook('prechangegroup', throw=True, source=srctype, url=url)
1909 self.hook('prechangegroup', throw=True, source=srctype, url=url)
1910
1910
1911 changesets = files = revisions = 0
1911 changesets = files = revisions = 0
1912
1912
1913 # write changelog data to temp files so concurrent readers will not see
1913 # write changelog data to temp files so concurrent readers will not see
1914 # inconsistent view
1914 # inconsistent view
1915 cl = self.changelog
1915 cl = self.changelog
1916 cl.delayupdate()
1916 cl.delayupdate()
1917 oldheads = len(cl.heads())
1917 oldheads = len(cl.heads())
1918
1918
1919 tr = self.transaction()
1919 tr = self.transaction()
1920 try:
1920 try:
1921 trp = weakref.proxy(tr)
1921 trp = weakref.proxy(tr)
1922 # pull off the changeset group
1922 # pull off the changeset group
1923 self.ui.status(_("adding changesets\n"))
1923 self.ui.status(_("adding changesets\n"))
1924 clstart = len(cl)
1924 clstart = len(cl)
1925 chunkiter = changegroup.chunkiter(source)
1925 chunkiter = changegroup.chunkiter(source)
1926 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
1926 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
1927 raise util.Abort(_("received changelog group is empty"))
1927 raise util.Abort(_("received changelog group is empty"))
1928 clend = len(cl)
1928 clend = len(cl)
1929 changesets = clend - clstart
1929 changesets = clend - clstart
1930
1930
1931 # pull off the manifest group
1931 # pull off the manifest group
1932 self.ui.status(_("adding manifests\n"))
1932 self.ui.status(_("adding manifests\n"))
1933 chunkiter = changegroup.chunkiter(source)
1933 chunkiter = changegroup.chunkiter(source)
1934 # no need to check for empty manifest group here:
1934 # no need to check for empty manifest group here:
1935 # if the result of the merge of 1 and 2 is the same in 3 and 4,
1935 # if the result of the merge of 1 and 2 is the same in 3 and 4,
1936 # no new manifest will be created and the manifest group will
1936 # no new manifest will be created and the manifest group will
1937 # be empty during the pull
1937 # be empty during the pull
1938 self.manifest.addgroup(chunkiter, revmap, trp)
1938 self.manifest.addgroup(chunkiter, revmap, trp)
1939
1939
1940 # process the files
1940 # process the files
1941 self.ui.status(_("adding file changes\n"))
1941 self.ui.status(_("adding file changes\n"))
1942 while 1:
1942 while 1:
1943 f = changegroup.getchunk(source)
1943 f = changegroup.getchunk(source)
1944 if not f:
1944 if not f:
1945 break
1945 break
1946 self.ui.debug(_("adding %s revisions\n") % f)
1946 self.ui.debug(_("adding %s revisions\n") % f)
1947 fl = self.file(f)
1947 fl = self.file(f)
1948 o = len(fl)
1948 o = len(fl)
1949 chunkiter = changegroup.chunkiter(source)
1949 chunkiter = changegroup.chunkiter(source)
1950 if fl.addgroup(chunkiter, revmap, trp) is None:
1950 if fl.addgroup(chunkiter, revmap, trp) is None:
1951 raise util.Abort(_("received file revlog group is empty"))
1951 raise util.Abort(_("received file revlog group is empty"))
1952 revisions += len(fl) - o
1952 revisions += len(fl) - o
1953 files += 1
1953 files += 1
1954
1954
1955 newheads = len(cl.heads())
1955 newheads = len(cl.heads())
1956 heads = ""
1956 heads = ""
1957 if oldheads and newheads != oldheads:
1957 if oldheads and newheads != oldheads:
1958 heads = _(" (%+d heads)") % (newheads - oldheads)
1958 heads = _(" (%+d heads)") % (newheads - oldheads)
1959
1959
1960 self.ui.status(_("added %d changesets"
1960 self.ui.status(_("added %d changesets"
1961 " with %d changes to %d files%s\n")
1961 " with %d changes to %d files%s\n")
1962 % (changesets, revisions, files, heads))
1962 % (changesets, revisions, files, heads))
1963
1963
1964 if changesets > 0:
1964 if changesets > 0:
1965 p = lambda: cl.writepending() and self.root or ""
1965 p = lambda: cl.writepending() and self.root or ""
1966 self.hook('pretxnchangegroup', throw=True,
1966 self.hook('pretxnchangegroup', throw=True,
1967 node=hex(cl.node(clstart)), source=srctype,
1967 node=hex(cl.node(clstart)), source=srctype,
1968 url=url, pending=p)
1968 url=url, pending=p)
1969
1969
1970 # make changelog see real files again
1970 # make changelog see real files again
1971 cl.finalize(trp)
1971 cl.finalize(trp)
1972
1972
1973 tr.close()
1973 tr.close()
1974 finally:
1974 finally:
1975 del tr
1975 del tr
1976
1976
1977 if changesets > 0:
1977 if changesets > 0:
1978 # forcefully update the on-disk branch cache
1978 # forcefully update the on-disk branch cache
1979 self.ui.debug(_("updating the branch cache\n"))
1979 self.ui.debug(_("updating the branch cache\n"))
1980 self.branchtags()
1980 self.branchtags()
1981 self.hook("changegroup", node=hex(cl.node(clstart)),
1981 self.hook("changegroup", node=hex(cl.node(clstart)),
1982 source=srctype, url=url)
1982 source=srctype, url=url)
1983
1983
1984 for i in xrange(clstart, clend):
1984 for i in xrange(clstart, clend):
1985 self.hook("incoming", node=hex(cl.node(i)),
1985 self.hook("incoming", node=hex(cl.node(i)),
1986 source=srctype, url=url)
1986 source=srctype, url=url)
1987
1987
1988 # never return 0 here:
1988 # never return 0 here:
1989 if newheads < oldheads:
1989 if newheads < oldheads:
1990 return newheads - oldheads - 1
1990 return newheads - oldheads - 1
1991 else:
1991 else:
1992 return newheads - oldheads + 1
1992 return newheads - oldheads + 1
1993
1993
1994
1994
1995 def stream_in(self, remote):
1995 def stream_in(self, remote):
1996 fp = remote.stream_out()
1996 fp = remote.stream_out()
1997 l = fp.readline()
1997 l = fp.readline()
1998 try:
1998 try:
1999 resp = int(l)
1999 resp = int(l)
2000 except ValueError:
2000 except ValueError:
2001 raise error.ResponseError(
2001 raise error.ResponseError(
2002 _('Unexpected response from remote server:'), l)
2002 _('Unexpected response from remote server:'), l)
2003 if resp == 1:
2003 if resp == 1:
2004 raise util.Abort(_('operation forbidden by server'))
2004 raise util.Abort(_('operation forbidden by server'))
2005 elif resp == 2:
2005 elif resp == 2:
2006 raise util.Abort(_('locking the remote repository failed'))
2006 raise util.Abort(_('locking the remote repository failed'))
2007 elif resp != 0:
2007 elif resp != 0:
2008 raise util.Abort(_('the server sent an unknown error code'))
2008 raise util.Abort(_('the server sent an unknown error code'))
2009 self.ui.status(_('streaming all changes\n'))
2009 self.ui.status(_('streaming all changes\n'))
2010 l = fp.readline()
2010 l = fp.readline()
2011 try:
2011 try:
2012 total_files, total_bytes = map(int, l.split(' ', 1))
2012 total_files, total_bytes = map(int, l.split(' ', 1))
2013 except (ValueError, TypeError):
2013 except (ValueError, TypeError):
2014 raise error.ResponseError(
2014 raise error.ResponseError(
2015 _('Unexpected response from remote server:'), l)
2015 _('Unexpected response from remote server:'), l)
2016 self.ui.status(_('%d files to transfer, %s of data\n') %
2016 self.ui.status(_('%d files to transfer, %s of data\n') %
2017 (total_files, util.bytecount(total_bytes)))
2017 (total_files, util.bytecount(total_bytes)))
2018 start = time.time()
2018 start = time.time()
2019 for i in xrange(total_files):
2019 for i in xrange(total_files):
2020 # XXX doesn't support '\n' or '\r' in filenames
2020 # XXX doesn't support '\n' or '\r' in filenames
2021 l = fp.readline()
2021 l = fp.readline()
2022 try:
2022 try:
2023 name, size = l.split('\0', 1)
2023 name, size = l.split('\0', 1)
2024 size = int(size)
2024 size = int(size)
2025 except (ValueError, TypeError):
2025 except (ValueError, TypeError):
2026 raise error.ResponseError(
2026 raise error.ResponseError(
2027 _('Unexpected response from remote server:'), l)
2027 _('Unexpected response from remote server:'), l)
2028 self.ui.debug(_('adding %s (%s)\n') % (name, util.bytecount(size)))
2028 self.ui.debug(_('adding %s (%s)\n') % (name, util.bytecount(size)))
2029 # for backwards compat, name was partially encoded
2029 # for backwards compat, name was partially encoded
2030 ofp = self.sopener(store.decodedir(name), 'w')
2030 ofp = self.sopener(store.decodedir(name), 'w')
2031 for chunk in util.filechunkiter(fp, limit=size):
2031 for chunk in util.filechunkiter(fp, limit=size):
2032 ofp.write(chunk)
2032 ofp.write(chunk)
2033 ofp.close()
2033 ofp.close()
2034 elapsed = time.time() - start
2034 elapsed = time.time() - start
2035 if elapsed <= 0:
2035 if elapsed <= 0:
2036 elapsed = 0.001
2036 elapsed = 0.001
2037 self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
2037 self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
2038 (util.bytecount(total_bytes), elapsed,
2038 (util.bytecount(total_bytes), elapsed,
2039 util.bytecount(total_bytes / elapsed)))
2039 util.bytecount(total_bytes / elapsed)))
2040 self.invalidate()
2040 self.invalidate()
2041 return len(self.heads()) + 1
2041 return len(self.heads()) + 1
2042
2042
2043 def clone(self, remote, heads=[], stream=False):
2043 def clone(self, remote, heads=[], stream=False):
2044 '''clone remote repository.
2044 '''clone remote repository.
2045
2045
2046 keyword arguments:
2046 keyword arguments:
2047 heads: list of revs to clone (forces use of pull)
2047 heads: list of revs to clone (forces use of pull)
2048 stream: use streaming clone if possible'''
2048 stream: use streaming clone if possible'''
2049
2049
2050 # now, all clients that can request uncompressed clones can
2050 # now, all clients that can request uncompressed clones can
2051 # read repo formats supported by all servers that can serve
2051 # read repo formats supported by all servers that can serve
2052 # them.
2052 # them.
2053
2053
2054 # if revlog format changes, client will have to check version
2054 # if revlog format changes, client will have to check version
2055 # and format flags on "stream" capability, and use
2055 # and format flags on "stream" capability, and use
2056 # uncompressed only if compatible.
2056 # uncompressed only if compatible.
2057
2057
2058 if stream and not heads and remote.capable('stream'):
2058 if stream and not heads and remote.capable('stream'):
2059 return self.stream_in(remote)
2059 return self.stream_in(remote)
2060 return self.pull(remote, heads)
2060 return self.pull(remote, heads)
2061
2061
2062 # used to avoid circular references so destructors work
2062 # used to avoid circular references so destructors work
2063 def aftertrans(files):
2063 def aftertrans(files):
2064 renamefiles = [tuple(t) for t in files]
2064 renamefiles = [tuple(t) for t in files]
2065 def a():
2065 def a():
2066 for src, dest in renamefiles:
2066 for src, dest in renamefiles:
2067 util.rename(src, dest)
2067 util.rename(src, dest)
2068 return a
2068 return a
2069
2069
2070 def instance(ui, path, create):
2070 def instance(ui, path, create):
2071 return localrepository(ui, util.drop_scheme('file', path), create)
2071 return localrepository(ui, util.drop_scheme('file', path), create)
2072
2072
2073 def islocal(path):
2073 def islocal(path):
2074 return True
2074 return True
@@ -1,216 +1,225
1 # sshserver.py - ssh protocol server support for mercurial
1 # sshserver.py - ssh protocol server support for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.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, incorporated herein by reference.
7 # GNU General Public License version 2, incorporated herein by reference.
8
8
9 from i18n import _
9 from i18n import _
10 from node import bin, hex
10 from node import bin, hex
11 import streamclone, util, hook
11 import streamclone, util, hook
12 import os, sys, tempfile
12 import os, sys, tempfile, urllib
13
13
14 class sshserver(object):
14 class sshserver(object):
15 def __init__(self, ui, repo):
15 def __init__(self, ui, repo):
16 self.ui = ui
16 self.ui = ui
17 self.repo = repo
17 self.repo = repo
18 self.lock = None
18 self.lock = None
19 self.fin = sys.stdin
19 self.fin = sys.stdin
20 self.fout = sys.stdout
20 self.fout = sys.stdout
21
21
22 hook.redirect(True)
22 hook.redirect(True)
23 sys.stdout = sys.stderr
23 sys.stdout = sys.stderr
24
24
25 # Prevent insertion/deletion of CRs
25 # Prevent insertion/deletion of CRs
26 util.set_binary(self.fin)
26 util.set_binary(self.fin)
27 util.set_binary(self.fout)
27 util.set_binary(self.fout)
28
28
29 def getarg(self):
29 def getarg(self):
30 argline = self.fin.readline()[:-1]
30 argline = self.fin.readline()[:-1]
31 arg, l = argline.split()
31 arg, l = argline.split()
32 val = self.fin.read(int(l))
32 val = self.fin.read(int(l))
33 return arg, val
33 return arg, val
34
34
35 def respond(self, v):
35 def respond(self, v):
36 self.fout.write("%d\n" % len(v))
36 self.fout.write("%d\n" % len(v))
37 self.fout.write(v)
37 self.fout.write(v)
38 self.fout.flush()
38 self.fout.flush()
39
39
40 def serve_forever(self):
40 def serve_forever(self):
41 try:
41 try:
42 while self.serve_one(): pass
42 while self.serve_one(): pass
43 finally:
43 finally:
44 if self.lock is not None:
44 if self.lock is not None:
45 self.lock.release()
45 self.lock.release()
46 sys.exit(0)
46 sys.exit(0)
47
47
48 def serve_one(self):
48 def serve_one(self):
49 cmd = self.fin.readline()[:-1]
49 cmd = self.fin.readline()[:-1]
50 if cmd:
50 if cmd:
51 impl = getattr(self, 'do_' + cmd, None)
51 impl = getattr(self, 'do_' + cmd, None)
52 if impl: impl()
52 if impl: impl()
53 else: self.respond("")
53 else: self.respond("")
54 return cmd != ''
54 return cmd != ''
55
55
56 def do_lookup(self):
56 def do_lookup(self):
57 arg, key = self.getarg()
57 arg, key = self.getarg()
58 assert arg == 'key'
58 assert arg == 'key'
59 try:
59 try:
60 r = hex(self.repo.lookup(key))
60 r = hex(self.repo.lookup(key))
61 success = 1
61 success = 1
62 except Exception,inst:
62 except Exception,inst:
63 r = str(inst)
63 r = str(inst)
64 success = 0
64 success = 0
65 self.respond("%s %s\n" % (success, r))
65 self.respond("%s %s\n" % (success, r))
66
66
67 def do_branchmap(self):
68 branchmap = self.repo.branchmap()
69 heads = []
70 for branch, nodes in branchmap.iteritems():
71 branchname = urllib.quote(branch)
72 branchnodes = [hex(node) for node in nodes]
73 heads.append('%s %s' % (branchname, ' '.join(branchnodes)))
74 self.respond('\n'.join(heads))
75
67 def do_heads(self):
76 def do_heads(self):
68 h = self.repo.heads()
77 h = self.repo.heads()
69 self.respond(" ".join(map(hex, h)) + "\n")
78 self.respond(" ".join(map(hex, h)) + "\n")
70
79
71 def do_hello(self):
80 def do_hello(self):
72 '''the hello command returns a set of lines describing various
81 '''the hello command returns a set of lines describing various
73 interesting things about the server, in an RFC822-like format.
82 interesting things about the server, in an RFC822-like format.
74 Currently the only one defined is "capabilities", which
83 Currently the only one defined is "capabilities", which
75 consists of a line in the form:
84 consists of a line in the form:
76
85
77 capabilities: space separated list of tokens
86 capabilities: space separated list of tokens
78 '''
87 '''
79
88
80 caps = ['unbundle', 'lookup', 'changegroupsubset']
89 caps = ['unbundle', 'lookup', 'changegroupsubset', 'branchmap']
81 if self.ui.configbool('server', 'uncompressed'):
90 if self.ui.configbool('server', 'uncompressed'):
82 caps.append('stream=%d' % self.repo.changelog.version)
91 caps.append('stream=%d' % self.repo.changelog.version)
83 self.respond("capabilities: %s\n" % (' '.join(caps),))
92 self.respond("capabilities: %s\n" % (' '.join(caps),))
84
93
85 def do_lock(self):
94 def do_lock(self):
86 '''DEPRECATED - allowing remote client to lock repo is not safe'''
95 '''DEPRECATED - allowing remote client to lock repo is not safe'''
87
96
88 self.lock = self.repo.lock()
97 self.lock = self.repo.lock()
89 self.respond("")
98 self.respond("")
90
99
91 def do_unlock(self):
100 def do_unlock(self):
92 '''DEPRECATED'''
101 '''DEPRECATED'''
93
102
94 if self.lock:
103 if self.lock:
95 self.lock.release()
104 self.lock.release()
96 self.lock = None
105 self.lock = None
97 self.respond("")
106 self.respond("")
98
107
99 def do_branches(self):
108 def do_branches(self):
100 arg, nodes = self.getarg()
109 arg, nodes = self.getarg()
101 nodes = map(bin, nodes.split(" "))
110 nodes = map(bin, nodes.split(" "))
102 r = []
111 r = []
103 for b in self.repo.branches(nodes):
112 for b in self.repo.branches(nodes):
104 r.append(" ".join(map(hex, b)) + "\n")
113 r.append(" ".join(map(hex, b)) + "\n")
105 self.respond("".join(r))
114 self.respond("".join(r))
106
115
107 def do_between(self):
116 def do_between(self):
108 arg, pairs = self.getarg()
117 arg, pairs = self.getarg()
109 pairs = [map(bin, p.split("-")) for p in pairs.split(" ")]
118 pairs = [map(bin, p.split("-")) for p in pairs.split(" ")]
110 r = []
119 r = []
111 for b in self.repo.between(pairs):
120 for b in self.repo.between(pairs):
112 r.append(" ".join(map(hex, b)) + "\n")
121 r.append(" ".join(map(hex, b)) + "\n")
113 self.respond("".join(r))
122 self.respond("".join(r))
114
123
115 def do_changegroup(self):
124 def do_changegroup(self):
116 nodes = []
125 nodes = []
117 arg, roots = self.getarg()
126 arg, roots = self.getarg()
118 nodes = map(bin, roots.split(" "))
127 nodes = map(bin, roots.split(" "))
119
128
120 cg = self.repo.changegroup(nodes, 'serve')
129 cg = self.repo.changegroup(nodes, 'serve')
121 while True:
130 while True:
122 d = cg.read(4096)
131 d = cg.read(4096)
123 if not d:
132 if not d:
124 break
133 break
125 self.fout.write(d)
134 self.fout.write(d)
126
135
127 self.fout.flush()
136 self.fout.flush()
128
137
129 def do_changegroupsubset(self):
138 def do_changegroupsubset(self):
130 argmap = dict([self.getarg(), self.getarg()])
139 argmap = dict([self.getarg(), self.getarg()])
131 bases = [bin(n) for n in argmap['bases'].split(' ')]
140 bases = [bin(n) for n in argmap['bases'].split(' ')]
132 heads = [bin(n) for n in argmap['heads'].split(' ')]
141 heads = [bin(n) for n in argmap['heads'].split(' ')]
133
142
134 cg = self.repo.changegroupsubset(bases, heads, 'serve')
143 cg = self.repo.changegroupsubset(bases, heads, 'serve')
135 while True:
144 while True:
136 d = cg.read(4096)
145 d = cg.read(4096)
137 if not d:
146 if not d:
138 break
147 break
139 self.fout.write(d)
148 self.fout.write(d)
140
149
141 self.fout.flush()
150 self.fout.flush()
142
151
143 def do_addchangegroup(self):
152 def do_addchangegroup(self):
144 '''DEPRECATED'''
153 '''DEPRECATED'''
145
154
146 if not self.lock:
155 if not self.lock:
147 self.respond("not locked")
156 self.respond("not locked")
148 return
157 return
149
158
150 self.respond("")
159 self.respond("")
151 r = self.repo.addchangegroup(self.fin, 'serve', self.client_url())
160 r = self.repo.addchangegroup(self.fin, 'serve', self.client_url())
152 self.respond(str(r))
161 self.respond(str(r))
153
162
154 def client_url(self):
163 def client_url(self):
155 client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
164 client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
156 return 'remote:ssh:' + client
165 return 'remote:ssh:' + client
157
166
158 def do_unbundle(self):
167 def do_unbundle(self):
159 their_heads = self.getarg()[1].split()
168 their_heads = self.getarg()[1].split()
160
169
161 def check_heads():
170 def check_heads():
162 heads = map(hex, self.repo.heads())
171 heads = map(hex, self.repo.heads())
163 return their_heads == [hex('force')] or their_heads == heads
172 return their_heads == [hex('force')] or their_heads == heads
164
173
165 # fail early if possible
174 # fail early if possible
166 if not check_heads():
175 if not check_heads():
167 self.respond(_('unsynced changes'))
176 self.respond(_('unsynced changes'))
168 return
177 return
169
178
170 self.respond('')
179 self.respond('')
171
180
172 # write bundle data to temporary file because it can be big
181 # write bundle data to temporary file because it can be big
173 tempname = fp = None
182 tempname = fp = None
174 try:
183 try:
175 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
184 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
176 fp = os.fdopen(fd, 'wb+')
185 fp = os.fdopen(fd, 'wb+')
177
186
178 count = int(self.fin.readline())
187 count = int(self.fin.readline())
179 while count:
188 while count:
180 fp.write(self.fin.read(count))
189 fp.write(self.fin.read(count))
181 count = int(self.fin.readline())
190 count = int(self.fin.readline())
182
191
183 was_locked = self.lock is not None
192 was_locked = self.lock is not None
184 if not was_locked:
193 if not was_locked:
185 self.lock = self.repo.lock()
194 self.lock = self.repo.lock()
186 try:
195 try:
187 if not check_heads():
196 if not check_heads():
188 # someone else committed/pushed/unbundled while we
197 # someone else committed/pushed/unbundled while we
189 # were transferring data
198 # were transferring data
190 self.respond(_('unsynced changes'))
199 self.respond(_('unsynced changes'))
191 return
200 return
192 self.respond('')
201 self.respond('')
193
202
194 # push can proceed
203 # push can proceed
195
204
196 fp.seek(0)
205 fp.seek(0)
197 r = self.repo.addchangegroup(fp, 'serve', self.client_url())
206 r = self.repo.addchangegroup(fp, 'serve', self.client_url())
198 self.respond(str(r))
207 self.respond(str(r))
199 finally:
208 finally:
200 if not was_locked:
209 if not was_locked:
201 self.lock.release()
210 self.lock.release()
202 self.lock = None
211 self.lock = None
203 finally:
212 finally:
204 if fp is not None:
213 if fp is not None:
205 fp.close()
214 fp.close()
206 if tempname is not None:
215 if tempname is not None:
207 os.unlink(tempname)
216 os.unlink(tempname)
208
217
209 def do_stream_out(self):
218 def do_stream_out(self):
210 try:
219 try:
211 for chunk in streamclone.stream_out(self.repo):
220 for chunk in streamclone.stream_out(self.repo):
212 self.fout.write(chunk)
221 self.fout.write(chunk)
213 self.fout.flush()
222 self.fout.flush()
214 except streamclone.StreamException, inst:
223 except streamclone.StreamException, inst:
215 self.fout.write(str(inst))
224 self.fout.write(str(inst))
216 self.fout.flush()
225 self.fout.flush()
@@ -1,988 +1,988
1 % Set up the repo
1 % Set up the repo
2 adding da/foo
2 adding da/foo
3 adding foo
3 adding foo
4 marked working directory as branch stable
4 marked working directory as branch stable
5 % Logs and changes
5 % Logs and changes
6 200 Script output follows
6 200 Script output follows
7
7
8 <?xml version="1.0" encoding="ascii"?>
8 <?xml version="1.0" encoding="ascii"?>
9 <feed xmlns="http://127.0.0.1/2005/Atom">
9 <feed xmlns="http://127.0.0.1/2005/Atom">
10 <!-- Changelog -->
10 <!-- Changelog -->
11 <id>http://127.0.0.1/</id>
11 <id>http://127.0.0.1/</id>
12 <link rel="self" href="http://127.0.0.1/atom-log"/>
12 <link rel="self" href="http://127.0.0.1/atom-log"/>
13 <link rel="alternate" href="http://127.0.0.1/"/>
13 <link rel="alternate" href="http://127.0.0.1/"/>
14 <title>test Changelog</title>
14 <title>test Changelog</title>
15 <updated>1970-01-01T00:00:00+00:00</updated>
15 <updated>1970-01-01T00:00:00+00:00</updated>
16
16
17 <entry>
17 <entry>
18 <title>branch</title>
18 <title>branch</title>
19 <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
19 <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
20 <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
20 <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
21 <author>
21 <author>
22 <name>test</name>
22 <name>test</name>
23 <email>&#116;&#101;&#115;&#116;</email>
23 <email>&#116;&#101;&#115;&#116;</email>
24 </author>
24 </author>
25 <updated>1970-01-01T00:00:00+00:00</updated>
25 <updated>1970-01-01T00:00:00+00:00</updated>
26 <published>1970-01-01T00:00:00+00:00</published>
26 <published>1970-01-01T00:00:00+00:00</published>
27 <content type="xhtml">
27 <content type="xhtml">
28 <div xmlns="http://127.0.0.1/1999/xhtml">
28 <div xmlns="http://127.0.0.1/1999/xhtml">
29 <pre xml:space="preserve">branch</pre>
29 <pre xml:space="preserve">branch</pre>
30 </div>
30 </div>
31 </content>
31 </content>
32 </entry>
32 </entry>
33 <entry>
33 <entry>
34 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
34 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
35 <id>http://127.0.0.1/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id>
35 <id>http://127.0.0.1/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id>
36 <link href="http://127.0.0.1/rev/a4f92ed23982be056b9852de5dfe873eaac7f0de"/>
36 <link href="http://127.0.0.1/rev/a4f92ed23982be056b9852de5dfe873eaac7f0de"/>
37 <author>
37 <author>
38 <name>test</name>
38 <name>test</name>
39 <email>&#116;&#101;&#115;&#116;</email>
39 <email>&#116;&#101;&#115;&#116;</email>
40 </author>
40 </author>
41 <updated>1970-01-01T00:00:00+00:00</updated>
41 <updated>1970-01-01T00:00:00+00:00</updated>
42 <published>1970-01-01T00:00:00+00:00</published>
42 <published>1970-01-01T00:00:00+00:00</published>
43 <content type="xhtml">
43 <content type="xhtml">
44 <div xmlns="http://127.0.0.1/1999/xhtml">
44 <div xmlns="http://127.0.0.1/1999/xhtml">
45 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
45 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
46 </div>
46 </div>
47 </content>
47 </content>
48 </entry>
48 </entry>
49 <entry>
49 <entry>
50 <title>base</title>
50 <title>base</title>
51 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
51 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
52 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
52 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
53 <author>
53 <author>
54 <name>test</name>
54 <name>test</name>
55 <email>&#116;&#101;&#115;&#116;</email>
55 <email>&#116;&#101;&#115;&#116;</email>
56 </author>
56 </author>
57 <updated>1970-01-01T00:00:00+00:00</updated>
57 <updated>1970-01-01T00:00:00+00:00</updated>
58 <published>1970-01-01T00:00:00+00:00</published>
58 <published>1970-01-01T00:00:00+00:00</published>
59 <content type="xhtml">
59 <content type="xhtml">
60 <div xmlns="http://127.0.0.1/1999/xhtml">
60 <div xmlns="http://127.0.0.1/1999/xhtml">
61 <pre xml:space="preserve">base</pre>
61 <pre xml:space="preserve">base</pre>
62 </div>
62 </div>
63 </content>
63 </content>
64 </entry>
64 </entry>
65
65
66 </feed>
66 </feed>
67 200 Script output follows
67 200 Script output follows
68
68
69 <?xml version="1.0" encoding="ascii"?>
69 <?xml version="1.0" encoding="ascii"?>
70 <feed xmlns="http://127.0.0.1/2005/Atom">
70 <feed xmlns="http://127.0.0.1/2005/Atom">
71 <!-- Changelog -->
71 <!-- Changelog -->
72 <id>http://127.0.0.1/</id>
72 <id>http://127.0.0.1/</id>
73 <link rel="self" href="http://127.0.0.1/atom-log"/>
73 <link rel="self" href="http://127.0.0.1/atom-log"/>
74 <link rel="alternate" href="http://127.0.0.1/"/>
74 <link rel="alternate" href="http://127.0.0.1/"/>
75 <title>test Changelog</title>
75 <title>test Changelog</title>
76 <updated>1970-01-01T00:00:00+00:00</updated>
76 <updated>1970-01-01T00:00:00+00:00</updated>
77
77
78 <entry>
78 <entry>
79 <title>branch</title>
79 <title>branch</title>
80 <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
80 <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
81 <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
81 <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
82 <author>
82 <author>
83 <name>test</name>
83 <name>test</name>
84 <email>&#116;&#101;&#115;&#116;</email>
84 <email>&#116;&#101;&#115;&#116;</email>
85 </author>
85 </author>
86 <updated>1970-01-01T00:00:00+00:00</updated>
86 <updated>1970-01-01T00:00:00+00:00</updated>
87 <published>1970-01-01T00:00:00+00:00</published>
87 <published>1970-01-01T00:00:00+00:00</published>
88 <content type="xhtml">
88 <content type="xhtml">
89 <div xmlns="http://127.0.0.1/1999/xhtml">
89 <div xmlns="http://127.0.0.1/1999/xhtml">
90 <pre xml:space="preserve">branch</pre>
90 <pre xml:space="preserve">branch</pre>
91 </div>
91 </div>
92 </content>
92 </content>
93 </entry>
93 </entry>
94 <entry>
94 <entry>
95 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
95 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
96 <id>http://127.0.0.1/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id>
96 <id>http://127.0.0.1/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id>
97 <link href="http://127.0.0.1/rev/a4f92ed23982be056b9852de5dfe873eaac7f0de"/>
97 <link href="http://127.0.0.1/rev/a4f92ed23982be056b9852de5dfe873eaac7f0de"/>
98 <author>
98 <author>
99 <name>test</name>
99 <name>test</name>
100 <email>&#116;&#101;&#115;&#116;</email>
100 <email>&#116;&#101;&#115;&#116;</email>
101 </author>
101 </author>
102 <updated>1970-01-01T00:00:00+00:00</updated>
102 <updated>1970-01-01T00:00:00+00:00</updated>
103 <published>1970-01-01T00:00:00+00:00</published>
103 <published>1970-01-01T00:00:00+00:00</published>
104 <content type="xhtml">
104 <content type="xhtml">
105 <div xmlns="http://127.0.0.1/1999/xhtml">
105 <div xmlns="http://127.0.0.1/1999/xhtml">
106 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
106 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
107 </div>
107 </div>
108 </content>
108 </content>
109 </entry>
109 </entry>
110 <entry>
110 <entry>
111 <title>base</title>
111 <title>base</title>
112 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
112 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
113 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
113 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
114 <author>
114 <author>
115 <name>test</name>
115 <name>test</name>
116 <email>&#116;&#101;&#115;&#116;</email>
116 <email>&#116;&#101;&#115;&#116;</email>
117 </author>
117 </author>
118 <updated>1970-01-01T00:00:00+00:00</updated>
118 <updated>1970-01-01T00:00:00+00:00</updated>
119 <published>1970-01-01T00:00:00+00:00</published>
119 <published>1970-01-01T00:00:00+00:00</published>
120 <content type="xhtml">
120 <content type="xhtml">
121 <div xmlns="http://127.0.0.1/1999/xhtml">
121 <div xmlns="http://127.0.0.1/1999/xhtml">
122 <pre xml:space="preserve">base</pre>
122 <pre xml:space="preserve">base</pre>
123 </div>
123 </div>
124 </content>
124 </content>
125 </entry>
125 </entry>
126
126
127 </feed>
127 </feed>
128 200 Script output follows
128 200 Script output follows
129
129
130 <?xml version="1.0" encoding="ascii"?>
130 <?xml version="1.0" encoding="ascii"?>
131 <feed xmlns="http://127.0.0.1/2005/Atom">
131 <feed xmlns="http://127.0.0.1/2005/Atom">
132 <id>http://127.0.0.1/atom-log/tip/foo</id>
132 <id>http://127.0.0.1/atom-log/tip/foo</id>
133 <link rel="self" href="http://127.0.0.1/atom-log/tip/foo"/>
133 <link rel="self" href="http://127.0.0.1/atom-log/tip/foo"/>
134 <title>test: foo history</title>
134 <title>test: foo history</title>
135 <updated>1970-01-01T00:00:00+00:00</updated>
135 <updated>1970-01-01T00:00:00+00:00</updated>
136
136
137 <entry>
137 <entry>
138 <title>base</title>
138 <title>base</title>
139 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
139 <id>http://127.0.0.1/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
140 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
140 <link href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
141 <author>
141 <author>
142 <name>test</name>
142 <name>test</name>
143 <email>&#116;&#101;&#115;&#116;</email>
143 <email>&#116;&#101;&#115;&#116;</email>
144 </author>
144 </author>
145 <updated>1970-01-01T00:00:00+00:00</updated>
145 <updated>1970-01-01T00:00:00+00:00</updated>
146 <published>1970-01-01T00:00:00+00:00</published>
146 <published>1970-01-01T00:00:00+00:00</published>
147 <content type="xhtml">
147 <content type="xhtml">
148 <div xmlns="http://127.0.0.1/1999/xhtml">
148 <div xmlns="http://127.0.0.1/1999/xhtml">
149 <pre xml:space="preserve">base</pre>
149 <pre xml:space="preserve">base</pre>
150 </div>
150 </div>
151 </content>
151 </content>
152 </entry>
152 </entry>
153
153
154 </feed>
154 </feed>
155 200 Script output follows
155 200 Script output follows
156
156
157 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
157 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
158 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
158 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
159 <head>
159 <head>
160 <link rel="icon" href="/static/hgicon.png" type="image/png" />
160 <link rel="icon" href="/static/hgicon.png" type="image/png" />
161 <meta name="robots" content="index, nofollow" />
161 <meta name="robots" content="index, nofollow" />
162 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
162 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
163
163
164 <title>test: log</title>
164 <title>test: log</title>
165 <link rel="alternate" type="application/atom+xml"
165 <link rel="alternate" type="application/atom+xml"
166 href="/atom-log" title="Atom feed for test" />
166 href="/atom-log" title="Atom feed for test" />
167 <link rel="alternate" type="application/rss+xml"
167 <link rel="alternate" type="application/rss+xml"
168 href="/rss-log" title="RSS feed for test" />
168 href="/rss-log" title="RSS feed for test" />
169 </head>
169 </head>
170 <body>
170 <body>
171
171
172 <div class="container">
172 <div class="container">
173 <div class="menu">
173 <div class="menu">
174 <div class="logo">
174 <div class="logo">
175 <a href="http://www.selenic.com/mercurial/">
175 <a href="http://www.selenic.com/mercurial/">
176 <img src="/static/hglogo.png" alt="mercurial" /></a>
176 <img src="/static/hglogo.png" alt="mercurial" /></a>
177 </div>
177 </div>
178 <ul>
178 <ul>
179 <li class="active">log</li>
179 <li class="active">log</li>
180 <li><a href="/graph/1d22e65f027e">graph</a></li>
180 <li><a href="/graph/1d22e65f027e">graph</a></li>
181 <li><a href="/tags">tags</a></li>
181 <li><a href="/tags">tags</a></li>
182 <li><a href="/branches">branches</a></li>
182 <li><a href="/branches">branches</a></li>
183 </ul>
183 </ul>
184 <ul>
184 <ul>
185 <li><a href="/rev/1d22e65f027e">changeset</a></li>
185 <li><a href="/rev/1d22e65f027e">changeset</a></li>
186 <li><a href="/file/1d22e65f027e">browse</a></li>
186 <li><a href="/file/1d22e65f027e">browse</a></li>
187 </ul>
187 </ul>
188 <ul>
188 <ul>
189
189
190 </ul>
190 </ul>
191 </div>
191 </div>
192
192
193 <div class="main">
193 <div class="main">
194 <h2><a href="/">test</a></h2>
194 <h2><a href="/">test</a></h2>
195 <h3>log</h3>
195 <h3>log</h3>
196
196
197 <form class="search" action="/log">
197 <form class="search" action="/log">
198
198
199 <p><input name="rev" id="search1" type="text" size="30" /></p>
199 <p><input name="rev" id="search1" type="text" size="30" /></p>
200 <div id="hint">find changesets by author, revision,
200 <div id="hint">find changesets by author, revision,
201 files, or words in the commit message</div>
201 files, or words in the commit message</div>
202 </form>
202 </form>
203
203
204 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
204 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
205
205
206 <table class="bigtable">
206 <table class="bigtable">
207 <tr>
207 <tr>
208 <th class="age">age</th>
208 <th class="age">age</th>
209 <th class="author">author</th>
209 <th class="author">author</th>
210 <th class="description">description</th>
210 <th class="description">description</th>
211 </tr>
211 </tr>
212 <tr class="parity0">
212 <tr class="parity0">
213 <td class="age">many years</td>
213 <td class="age">many years</td>
214 <td class="author">test</td>
214 <td class="author">test</td>
215 <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
215 <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
216 </tr>
216 </tr>
217 <tr class="parity1">
217 <tr class="parity1">
218 <td class="age">many years</td>
218 <td class="age">many years</td>
219 <td class="author">test</td>
219 <td class="author">test</td>
220 <td class="description"><a href="/rev/a4f92ed23982">Added tag 1.0 for changeset 2ef0ac749a14</a><span class="branchhead">default</span> </td>
220 <td class="description"><a href="/rev/a4f92ed23982">Added tag 1.0 for changeset 2ef0ac749a14</a><span class="branchhead">default</span> </td>
221 </tr>
221 </tr>
222 <tr class="parity0">
222 <tr class="parity0">
223 <td class="age">many years</td>
223 <td class="age">many years</td>
224 <td class="author">test</td>
224 <td class="author">test</td>
225 <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
225 <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
226 </tr>
226 </tr>
227
227
228 </table>
228 </table>
229
229
230 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
230 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
231 </div>
231 </div>
232 </div>
232 </div>
233
233
234
234
235
235
236 </body>
236 </body>
237 </html>
237 </html>
238
238
239 200 Script output follows
239 200 Script output follows
240
240
241 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
241 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
242 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
242 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
243 <head>
243 <head>
244 <link rel="icon" href="/static/hgicon.png" type="image/png" />
244 <link rel="icon" href="/static/hgicon.png" type="image/png" />
245 <meta name="robots" content="index, nofollow" />
245 <meta name="robots" content="index, nofollow" />
246 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
246 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
247
247
248 <title>test: 2ef0ac749a14</title>
248 <title>test: 2ef0ac749a14</title>
249 </head>
249 </head>
250 <body>
250 <body>
251 <div class="container">
251 <div class="container">
252 <div class="menu">
252 <div class="menu">
253 <div class="logo">
253 <div class="logo">
254 <a href="http://www.selenic.com/mercurial/">
254 <a href="http://www.selenic.com/mercurial/">
255 <img src="/static/hglogo.png" alt="mercurial" /></a>
255 <img src="/static/hglogo.png" alt="mercurial" /></a>
256 </div>
256 </div>
257 <ul>
257 <ul>
258 <li><a href="/shortlog/2ef0ac749a14">log</a></li>
258 <li><a href="/shortlog/2ef0ac749a14">log</a></li>
259 <li><a href="/graph/2ef0ac749a14">graph</a></li>
259 <li><a href="/graph/2ef0ac749a14">graph</a></li>
260 <li><a href="/tags">tags</a></li>
260 <li><a href="/tags">tags</a></li>
261 <li><a href="/branches">branches</a></li>
261 <li><a href="/branches">branches</a></li>
262 </ul>
262 </ul>
263 <ul>
263 <ul>
264 <li class="active">changeset</li>
264 <li class="active">changeset</li>
265 <li><a href="/raw-rev/2ef0ac749a14">raw</a></li>
265 <li><a href="/raw-rev/2ef0ac749a14">raw</a></li>
266 <li><a href="/file/2ef0ac749a14">browse</a></li>
266 <li><a href="/file/2ef0ac749a14">browse</a></li>
267 </ul>
267 </ul>
268 <ul>
268 <ul>
269
269
270 </ul>
270 </ul>
271 </div>
271 </div>
272
272
273 <div class="main">
273 <div class="main">
274
274
275 <h2><a href="/">test</a></h2>
275 <h2><a href="/">test</a></h2>
276 <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
276 <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
277
277
278 <form class="search" action="/log">
278 <form class="search" action="/log">
279
279
280 <p><input name="rev" id="search1" type="text" size="30" /></p>
280 <p><input name="rev" id="search1" type="text" size="30" /></p>
281 <div id="hint">find changesets by author, revision,
281 <div id="hint">find changesets by author, revision,
282 files, or words in the commit message</div>
282 files, or words in the commit message</div>
283 </form>
283 </form>
284
284
285 <div class="description">base</div>
285 <div class="description">base</div>
286
286
287 <table id="changesetEntry">
287 <table id="changesetEntry">
288 <tr>
288 <tr>
289 <th class="author">author</th>
289 <th class="author">author</th>
290 <td class="author">&#116;&#101;&#115;&#116;</td>
290 <td class="author">&#116;&#101;&#115;&#116;</td>
291 </tr>
291 </tr>
292 <tr>
292 <tr>
293 <th class="date">date</th>
293 <th class="date">date</th>
294 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (many years ago)</td></tr>
294 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (many years ago)</td></tr>
295 <tr>
295 <tr>
296 <th class="author">parents</th>
296 <th class="author">parents</th>
297 <td class="author"></td>
297 <td class="author"></td>
298 </tr>
298 </tr>
299 <tr>
299 <tr>
300 <th class="author">children</th>
300 <th class="author">children</th>
301 <td class="author"> <a href="/rev/a4f92ed23982">a4f92ed23982</a></td>
301 <td class="author"> <a href="/rev/a4f92ed23982">a4f92ed23982</a></td>
302 </tr>
302 </tr>
303 <tr>
303 <tr>
304 <th class="files">files</th>
304 <th class="files">files</th>
305 <td class="files"><a href="/file/2ef0ac749a14/da/foo">da/foo</a> <a href="/file/2ef0ac749a14/foo">foo</a> </td>
305 <td class="files"><a href="/file/2ef0ac749a14/da/foo">da/foo</a> <a href="/file/2ef0ac749a14/foo">foo</a> </td>
306 </tr>
306 </tr>
307 </table>
307 </table>
308
308
309 <div class="overflow">
309 <div class="overflow">
310 <div class="sourcefirst"> line diff</div>
310 <div class="sourcefirst"> line diff</div>
311
311
312 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
312 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
313 </span><a href="#l1.2" id="l1.2"> 1.2</a> <span class="plusline">+++ b/da/foo Thu Jan 01 00:00:00 1970 +0000
313 </span><a href="#l1.2" id="l1.2"> 1.2</a> <span class="plusline">+++ b/da/foo Thu Jan 01 00:00:00 1970 +0000
314 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="atline">@@ -0,0 +1,1 @@
314 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="atline">@@ -0,0 +1,1 @@
315 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+foo
315 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+foo
316 </span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
316 </span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
317 </span><a href="#l2.2" id="l2.2"> 2.2</a> <span class="plusline">+++ b/foo Thu Jan 01 00:00:00 1970 +0000
317 </span><a href="#l2.2" id="l2.2"> 2.2</a> <span class="plusline">+++ b/foo Thu Jan 01 00:00:00 1970 +0000
318 </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="atline">@@ -0,0 +1,1 @@
318 </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="atline">@@ -0,0 +1,1 @@
319 </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="plusline">+foo
319 </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="plusline">+foo
320 </span></pre></div>
320 </span></pre></div>
321 </div>
321 </div>
322
322
323 </div>
323 </div>
324 </div>
324 </div>
325
325
326
326
327 </body>
327 </body>
328 </html>
328 </html>
329
329
330 200 Script output follows
330 200 Script output follows
331
331
332
332
333 # HG changeset patch
333 # HG changeset patch
334 # User test
334 # User test
335 # Date 0 0
335 # Date 0 0
336 # Node ID a4f92ed23982be056b9852de5dfe873eaac7f0de
336 # Node ID a4f92ed23982be056b9852de5dfe873eaac7f0de
337 # Parent 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
337 # Parent 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
338 Added tag 1.0 for changeset 2ef0ac749a14
338 Added tag 1.0 for changeset 2ef0ac749a14
339
339
340 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
340 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
341 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
341 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
342 @@ -0,0 +1,1 @@
342 @@ -0,0 +1,1 @@
343 +2ef0ac749a14e4f57a5a822464a0902c6f7f448f 1.0
343 +2ef0ac749a14e4f57a5a822464a0902c6f7f448f 1.0
344
344
345 % File-related
345 % File-related
346 200 Script output follows
346 200 Script output follows
347
347
348 foo
348 foo
349 200 Script output follows
349 200 Script output follows
350
350
351
351
352 test@0: foo
352 test@0: foo
353
353
354
354
355
355
356
356
357 200 Script output follows
357 200 Script output follows
358
358
359
359
360 drwxr-xr-x da
360 drwxr-xr-x da
361 -rw-r--r-- 45 .hgtags
361 -rw-r--r-- 45 .hgtags
362 -rw-r--r-- 4 foo
362 -rw-r--r-- 4 foo
363
363
364
364
365 200 Script output follows
365 200 Script output follows
366
366
367 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
367 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
368 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
368 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
369 <head>
369 <head>
370 <link rel="icon" href="/static/hgicon.png" type="image/png" />
370 <link rel="icon" href="/static/hgicon.png" type="image/png" />
371 <meta name="robots" content="index, nofollow" />
371 <meta name="robots" content="index, nofollow" />
372 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
372 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
373
373
374 <title>test: a4f92ed23982 foo</title>
374 <title>test: a4f92ed23982 foo</title>
375 </head>
375 </head>
376 <body>
376 <body>
377
377
378 <div class="container">
378 <div class="container">
379 <div class="menu">
379 <div class="menu">
380 <div class="logo">
380 <div class="logo">
381 <a href="http://www.selenic.com/mercurial/">
381 <a href="http://www.selenic.com/mercurial/">
382 <img src="/static/hglogo.png" alt="mercurial" /></a>
382 <img src="/static/hglogo.png" alt="mercurial" /></a>
383 </div>
383 </div>
384 <ul>
384 <ul>
385 <li><a href="/shortlog/a4f92ed23982">log</a></li>
385 <li><a href="/shortlog/a4f92ed23982">log</a></li>
386 <li><a href="/graph/a4f92ed23982">graph</a></li>
386 <li><a href="/graph/a4f92ed23982">graph</a></li>
387 <li><a href="/tags">tags</a></li>
387 <li><a href="/tags">tags</a></li>
388 <li><a href="/branches">branches</a></li>
388 <li><a href="/branches">branches</a></li>
389 </ul>
389 </ul>
390 <ul>
390 <ul>
391 <li><a href="/rev/a4f92ed23982">changeset</a></li>
391 <li><a href="/rev/a4f92ed23982">changeset</a></li>
392 <li><a href="/file/a4f92ed23982/">browse</a></li>
392 <li><a href="/file/a4f92ed23982/">browse</a></li>
393 </ul>
393 </ul>
394 <ul>
394 <ul>
395 <li class="active">file</li>
395 <li class="active">file</li>
396 <li><a href="/diff/a4f92ed23982/foo">diff</a></li>
396 <li><a href="/diff/a4f92ed23982/foo">diff</a></li>
397 <li><a href="/annotate/a4f92ed23982/foo">annotate</a></li>
397 <li><a href="/annotate/a4f92ed23982/foo">annotate</a></li>
398 <li><a href="/log/a4f92ed23982/foo">file log</a></li>
398 <li><a href="/log/a4f92ed23982/foo">file log</a></li>
399 <li><a href="/raw-file/a4f92ed23982/foo">raw</a></li>
399 <li><a href="/raw-file/a4f92ed23982/foo">raw</a></li>
400 </ul>
400 </ul>
401 </div>
401 </div>
402
402
403 <div class="main">
403 <div class="main">
404 <h2><a href="/">test</a></h2>
404 <h2><a href="/">test</a></h2>
405 <h3>view foo @ 1:a4f92ed23982</h3>
405 <h3>view foo @ 1:a4f92ed23982</h3>
406
406
407 <form class="search" action="/log">
407 <form class="search" action="/log">
408
408
409 <p><input name="rev" id="search1" type="text" size="30" /></p>
409 <p><input name="rev" id="search1" type="text" size="30" /></p>
410 <div id="hint">find changesets by author, revision,
410 <div id="hint">find changesets by author, revision,
411 files, or words in the commit message</div>
411 files, or words in the commit message</div>
412 </form>
412 </form>
413
413
414 <div class="description">Added tag 1.0 for changeset 2ef0ac749a14</div>
414 <div class="description">Added tag 1.0 for changeset 2ef0ac749a14</div>
415
415
416 <table id="changesetEntry">
416 <table id="changesetEntry">
417 <tr>
417 <tr>
418 <th class="author">author</th>
418 <th class="author">author</th>
419 <td class="author">&#116;&#101;&#115;&#116;</td>
419 <td class="author">&#116;&#101;&#115;&#116;</td>
420 </tr>
420 </tr>
421 <tr>
421 <tr>
422 <th class="date">date</th>
422 <th class="date">date</th>
423 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (many years ago)</td>
423 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (many years ago)</td>
424 </tr>
424 </tr>
425 <tr>
425 <tr>
426 <th class="author">parents</th>
426 <th class="author">parents</th>
427 <td class="author"></td>
427 <td class="author"></td>
428 </tr>
428 </tr>
429 <tr>
429 <tr>
430 <th class="author">children</th>
430 <th class="author">children</th>
431 <td class="author"><a href="/file/1d22e65f027e/foo">1d22e65f027e</a> </td>
431 <td class="author"><a href="/file/1d22e65f027e/foo">1d22e65f027e</a> </td>
432 </tr>
432 </tr>
433
433
434 </table>
434 </table>
435
435
436 <div class="overflow">
436 <div class="overflow">
437 <div class="sourcefirst"> line source</div>
437 <div class="sourcefirst"> line source</div>
438
438
439 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> foo
439 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> foo
440 </div>
440 </div>
441 <div class="sourcelast"></div>
441 <div class="sourcelast"></div>
442 </div>
442 </div>
443 </div>
443 </div>
444 </div>
444 </div>
445
445
446
446
447
447
448 </body>
448 </body>
449 </html>
449 </html>
450
450
451 200 Script output follows
451 200 Script output follows
452
452
453
453
454 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
454 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
455 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
455 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
456 @@ -0,0 +1,1 @@
456 @@ -0,0 +1,1 @@
457 +foo
457 +foo
458
458
459
459
460
460
461
461
462 % Overviews
462 % Overviews
463 200 Script output follows
463 200 Script output follows
464
464
465 <?xml version="1.0" encoding="ascii"?>
465 <?xml version="1.0" encoding="ascii"?>
466 <feed xmlns="http://127.0.0.1/2005/Atom">
466 <feed xmlns="http://127.0.0.1/2005/Atom">
467 <id>http://127.0.0.1/</id>
467 <id>http://127.0.0.1/</id>
468 <link rel="self" href="http://127.0.0.1/atom-tags"/>
468 <link rel="self" href="http://127.0.0.1/atom-tags"/>
469 <link rel="alternate" href="http://127.0.0.1/tags"/>
469 <link rel="alternate" href="http://127.0.0.1/tags"/>
470 <title>test: tags</title>
470 <title>test: tags</title>
471 <summary>test tag history</summary>
471 <summary>test tag history</summary>
472 <author><name>Mercurial SCM</name></author>
472 <author><name>Mercurial SCM</name></author>
473 <updated>1970-01-01T00:00:00+00:00</updated>
473 <updated>1970-01-01T00:00:00+00:00</updated>
474
474
475 <entry>
475 <entry>
476 <title>1.0</title>
476 <title>1.0</title>
477 <link rel="alternate" href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
477 <link rel="alternate" href="http://127.0.0.1/rev/2ef0ac749a14e4f57a5a822464a0902c6f7f448f"/>
478 <id>http://127.0.0.1/#tag-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
478 <id>http://127.0.0.1/#tag-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id>
479 <updated>1970-01-01T00:00:00+00:00</updated>
479 <updated>1970-01-01T00:00:00+00:00</updated>
480 <published>1970-01-01T00:00:00+00:00</published>
480 <published>1970-01-01T00:00:00+00:00</published>
481 <content type="text">1.0</content>
481 <content type="text">1.0</content>
482 </entry>
482 </entry>
483
483
484 </feed>
484 </feed>
485 200 Script output follows
485 200 Script output follows
486
486
487 <?xml version="1.0" encoding="ascii"?>
487 <?xml version="1.0" encoding="ascii"?>
488 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://127.0.0.1/TR/xhtml1/DTD/xhtml1-strict.dtd">
488 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://127.0.0.1/TR/xhtml1/DTD/xhtml1-strict.dtd">
489 <html xmlns="http://127.0.0.1/1999/xhtml" xml:lang="en-US" lang="en-US">
489 <html xmlns="http://127.0.0.1/1999/xhtml" xml:lang="en-US" lang="en-US">
490 <head>
490 <head>
491 <link rel="icon" href="/static/hgicon.png" type="image/png" />
491 <link rel="icon" href="/static/hgicon.png" type="image/png" />
492 <meta name="robots" content="index, nofollow"/>
492 <meta name="robots" content="index, nofollow"/>
493 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
493 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
494
494
495
495
496 <title>test: Branches</title>
496 <title>test: Branches</title>
497 <link rel="alternate" type="application/atom+xml"
497 <link rel="alternate" type="application/atom+xml"
498 href="/atom-tags" title="Atom feed for test"/>
498 href="/atom-tags" title="Atom feed for test"/>
499 <link rel="alternate" type="application/rss+xml"
499 <link rel="alternate" type="application/rss+xml"
500 href="/rss-tags" title="RSS feed for test"/>
500 href="/rss-tags" title="RSS feed for test"/>
501 </head>
501 </head>
502 <body>
502 <body>
503
503
504 <div class="page_header">
504 <div class="page_header">
505 <a href="http://127.0.0.1/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / branches
505 <a href="http://127.0.0.1/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / branches
506 </div>
506 </div>
507
507
508 <div class="page_nav">
508 <div class="page_nav">
509 <a href="/summary?style=gitweb">summary</a> |
509 <a href="/summary?style=gitweb">summary</a> |
510 <a href="/shortlog?style=gitweb">shortlog</a> |
510 <a href="/shortlog?style=gitweb">shortlog</a> |
511 <a href="/log?style=gitweb">changelog</a> |
511 <a href="/log?style=gitweb">changelog</a> |
512 <a href="/graph?style=gitweb">graph</a> |
512 <a href="/graph?style=gitweb">graph</a> |
513 <a href="/tags?style=gitweb">tags</a> |
513 <a href="/tags?style=gitweb">tags</a> |
514 branches |
514 branches |
515 <a href="/file/1d22e65f027e?style=gitweb">files</a>
515 <a href="/file/1d22e65f027e?style=gitweb">files</a>
516 <br/>
516 <br/>
517 </div>
517 </div>
518
518
519 <div class="title">&nbsp;</div>
519 <div class="title">&nbsp;</div>
520 <table cellspacing="0">
520 <table cellspacing="0">
521
521
522 <tr class="parity0">
522 <tr class="parity0">
523 <td class="age"><i>many years ago</i></td>
523 <td class="age"><i>many years ago</i></td>
524 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
524 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
525 <td>stable</td>
525 <td>stable</td>
526 <td class="link">
526 <td class="link">
527 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
527 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
528 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
528 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
529 <a href="/file/1d22e65f027e?style=gitweb">files</a>
529 <a href="/file/1d22e65f027e?style=gitweb">files</a>
530 </td>
530 </td>
531 </tr>
531 </tr>
532 <tr class="parity1">
532 <tr class="parity1">
533 <td class="age"><i>many years ago</i></td>
533 <td class="age"><i>many years ago</i></td>
534 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
534 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
535 <td>default</td>
535 <td>default</td>
536 <td class="link">
536 <td class="link">
537 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
537 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
538 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
538 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
539 <a href="/file/a4f92ed23982?style=gitweb">files</a>
539 <a href="/file/a4f92ed23982?style=gitweb">files</a>
540 </td>
540 </td>
541 </tr>
541 </tr>
542 </table>
542 </table>
543
543
544 <div class="page_footer">
544 <div class="page_footer">
545 <div class="page_footer_text">test</div>
545 <div class="page_footer_text">test</div>
546 <div class="rss_logo">
546 <div class="rss_logo">
547 <a href="/rss-log">RSS</a>
547 <a href="/rss-log">RSS</a>
548 <a href="/atom-log">Atom</a>
548 <a href="/atom-log">Atom</a>
549 </div>
549 </div>
550 <br />
550 <br />
551
551
552 </div>
552 </div>
553 </body>
553 </body>
554 </html>
554 </html>
555
555
556 200 Script output follows
556 200 Script output follows
557
557
558 <?xml version="1.0" encoding="ascii"?>
558 <?xml version="1.0" encoding="ascii"?>
559 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
559 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
560 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
560 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
561 <head>
561 <head>
562 <link rel="icon" href="/static/hgicon.png" type="image/png" />
562 <link rel="icon" href="/static/hgicon.png" type="image/png" />
563 <meta name="robots" content="index, nofollow"/>
563 <meta name="robots" content="index, nofollow"/>
564 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
564 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
565
565
566
566
567 <title>test: Summary</title>
567 <title>test: Summary</title>
568 <link rel="alternate" type="application/atom+xml"
568 <link rel="alternate" type="application/atom+xml"
569 href="/atom-log" title="Atom feed for test"/>
569 href="/atom-log" title="Atom feed for test"/>
570 <link rel="alternate" type="application/rss+xml"
570 <link rel="alternate" type="application/rss+xml"
571 href="/rss-log" title="RSS feed for test"/>
571 href="/rss-log" title="RSS feed for test"/>
572 </head>
572 </head>
573 <body>
573 <body>
574
574
575 <div class="page_header">
575 <div class="page_header">
576 <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / summary
576 <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / summary
577
577
578 <form action="/log">
578 <form action="/log">
579 <input type="hidden" name="style" value="gitweb" />
579 <input type="hidden" name="style" value="gitweb" />
580 <div class="search">
580 <div class="search">
581 <input type="text" name="rev" />
581 <input type="text" name="rev" />
582 </div>
582 </div>
583 </form>
583 </form>
584 </div>
584 </div>
585
585
586 <div class="page_nav">
586 <div class="page_nav">
587 summary |
587 summary |
588 <a href="/shortlog?style=gitweb">shortlog</a> |
588 <a href="/shortlog?style=gitweb">shortlog</a> |
589 <a href="/log?style=gitweb">changelog</a> |
589 <a href="/log?style=gitweb">changelog</a> |
590 <a href="/graph?style=gitweb">graph</a> |
590 <a href="/graph?style=gitweb">graph</a> |
591 <a href="/tags?style=gitweb">tags</a> |
591 <a href="/tags?style=gitweb">tags</a> |
592 <a href="/branches?style=gitweb">branches</a> |
592 <a href="/branches?style=gitweb">branches</a> |
593 <a href="/file/1d22e65f027e?style=gitweb">files</a>
593 <a href="/file/1d22e65f027e?style=gitweb">files</a>
594 <br/>
594 <br/>
595 </div>
595 </div>
596
596
597 <div class="title">&nbsp;</div>
597 <div class="title">&nbsp;</div>
598 <table cellspacing="0">
598 <table cellspacing="0">
599 <tr><td>description</td><td>unknown</td></tr>
599 <tr><td>description</td><td>unknown</td></tr>
600 <tr><td>owner</td><td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td></tr>
600 <tr><td>owner</td><td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td></tr>
601 <tr><td>last change</td><td>Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
601 <tr><td>last change</td><td>Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
602 </table>
602 </table>
603
603
604 <div><a class="title" href="/shortlog?style=gitweb">changes</a></div>
604 <div><a class="title" href="/shortlog?style=gitweb">changes</a></div>
605 <table cellspacing="0">
605 <table cellspacing="0">
606
606
607 <tr class="parity0">
607 <tr class="parity0">
608 <td class="age"><i>many years ago</i></td>
608 <td class="age"><i>many years ago</i></td>
609 <td><i>test</i></td>
609 <td><i>test</i></td>
610 <td>
610 <td>
611 <a class="list" href="/rev/1d22e65f027e?style=gitweb">
611 <a class="list" href="/rev/1d22e65f027e?style=gitweb">
612 <b>branch</b>
612 <b>branch</b>
613 <span class="logtags"><span class="branchtag" title="stable">stable</span> <span class="tagtag" title="tip">tip</span> </span>
613 <span class="logtags"><span class="branchtag" title="stable">stable</span> <span class="tagtag" title="tip">tip</span> </span>
614 </a>
614 </a>
615 </td>
615 </td>
616 <td class="link" nowrap>
616 <td class="link" nowrap>
617 <a href="/rev/1d22e65f027e?style=gitweb">changeset</a> |
617 <a href="/rev/1d22e65f027e?style=gitweb">changeset</a> |
618 <a href="/file/1d22e65f027e?style=gitweb">files</a>
618 <a href="/file/1d22e65f027e?style=gitweb">files</a>
619 </td>
619 </td>
620 </tr>
620 </tr>
621 <tr class="parity1">
621 <tr class="parity1">
622 <td class="age"><i>many years ago</i></td>
622 <td class="age"><i>many years ago</i></td>
623 <td><i>test</i></td>
623 <td><i>test</i></td>
624 <td>
624 <td>
625 <a class="list" href="/rev/a4f92ed23982?style=gitweb">
625 <a class="list" href="/rev/a4f92ed23982?style=gitweb">
626 <b>Added tag 1.0 for changeset 2ef0ac749a14</b>
626 <b>Added tag 1.0 for changeset 2ef0ac749a14</b>
627 <span class="logtags"><span class="branchtag" title="default">default</span> </span>
627 <span class="logtags"><span class="branchtag" title="default">default</span> </span>
628 </a>
628 </a>
629 </td>
629 </td>
630 <td class="link" nowrap>
630 <td class="link" nowrap>
631 <a href="/rev/a4f92ed23982?style=gitweb">changeset</a> |
631 <a href="/rev/a4f92ed23982?style=gitweb">changeset</a> |
632 <a href="/file/a4f92ed23982?style=gitweb">files</a>
632 <a href="/file/a4f92ed23982?style=gitweb">files</a>
633 </td>
633 </td>
634 </tr>
634 </tr>
635 <tr class="parity0">
635 <tr class="parity0">
636 <td class="age"><i>many years ago</i></td>
636 <td class="age"><i>many years ago</i></td>
637 <td><i>test</i></td>
637 <td><i>test</i></td>
638 <td>
638 <td>
639 <a class="list" href="/rev/2ef0ac749a14?style=gitweb">
639 <a class="list" href="/rev/2ef0ac749a14?style=gitweb">
640 <b>base</b>
640 <b>base</b>
641 <span class="logtags"><span class="tagtag" title="1.0">1.0</span> </span>
641 <span class="logtags"><span class="tagtag" title="1.0">1.0</span> </span>
642 </a>
642 </a>
643 </td>
643 </td>
644 <td class="link" nowrap>
644 <td class="link" nowrap>
645 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
645 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
646 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
646 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
647 </td>
647 </td>
648 </tr>
648 </tr>
649 <tr class="light"><td colspan="4"><a class="list" href="/shortlog?style=gitweb">...</a></td></tr>
649 <tr class="light"><td colspan="4"><a class="list" href="/shortlog?style=gitweb">...</a></td></tr>
650 </table>
650 </table>
651
651
652 <div><a class="title" href="/tags?style=gitweb">tags</a></div>
652 <div><a class="title" href="/tags?style=gitweb">tags</a></div>
653 <table cellspacing="0">
653 <table cellspacing="0">
654
654
655 <tr class="parity0">
655 <tr class="parity0">
656 <td class="age"><i>many years ago</i></td>
656 <td class="age"><i>many years ago</i></td>
657 <td><a class="list" href="/rev/2ef0ac749a14?style=gitweb"><b>1.0</b></a></td>
657 <td><a class="list" href="/rev/2ef0ac749a14?style=gitweb"><b>1.0</b></a></td>
658 <td class="link">
658 <td class="link">
659 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
659 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
660 <a href="/log/2ef0ac749a14?style=gitweb">changelog</a> |
660 <a href="/log/2ef0ac749a14?style=gitweb">changelog</a> |
661 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
661 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
662 </td>
662 </td>
663 </tr>
663 </tr>
664 <tr class="light"><td colspan="3"><a class="list" href="/tags?style=gitweb">...</a></td></tr>
664 <tr class="light"><td colspan="3"><a class="list" href="/tags?style=gitweb">...</a></td></tr>
665 </table>
665 </table>
666
666
667 <div><a class="title" href="#">branches</a></div>
667 <div><a class="title" href="#">branches</a></div>
668 <table cellspacing="0">
668 <table cellspacing="0">
669
669
670 <tr class="parity0">
670 <tr class="parity0">
671 <td class="age"><i>many years ago</i></td>
671 <td class="age"><i>many years ago</i></td>
672 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
672 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
673 <td>stable</td>
673 <td>stable</td>
674 <td class="link">
674 <td class="link">
675 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
675 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
676 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
676 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
677 <a href="/file/1d22e65f027e?style=gitweb">files</a>
677 <a href="/file/1d22e65f027e?style=gitweb">files</a>
678 </td>
678 </td>
679 </tr>
679 </tr>
680 <tr class="parity1">
680 <tr class="parity1">
681 <td class="age"><i>many years ago</i></td>
681 <td class="age"><i>many years ago</i></td>
682 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
682 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
683 <td>default</td>
683 <td>default</td>
684 <td class="link">
684 <td class="link">
685 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
685 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
686 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
686 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
687 <a href="/file/a4f92ed23982?style=gitweb">files</a>
687 <a href="/file/a4f92ed23982?style=gitweb">files</a>
688 </td>
688 </td>
689 </tr>
689 </tr>
690 <tr class="light">
690 <tr class="light">
691 <td colspan="4"><a class="list" href="#">...</a></td>
691 <td colspan="4"><a class="list" href="#">...</a></td>
692 </tr>
692 </tr>
693 </table>
693 </table>
694 <div class="page_footer">
694 <div class="page_footer">
695 <div class="page_footer_text">test</div>
695 <div class="page_footer_text">test</div>
696 <div class="rss_logo">
696 <div class="rss_logo">
697 <a href="/rss-log">RSS</a>
697 <a href="/rss-log">RSS</a>
698 <a href="/atom-log">Atom</a>
698 <a href="/atom-log">Atom</a>
699 </div>
699 </div>
700 <br />
700 <br />
701
701
702 </div>
702 </div>
703 </body>
703 </body>
704 </html>
704 </html>
705
705
706 200 Script output follows
706 200 Script output follows
707
707
708 <?xml version="1.0" encoding="ascii"?>
708 <?xml version="1.0" encoding="ascii"?>
709 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
709 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
710 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
710 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
711 <head>
711 <head>
712 <link rel="icon" href="/static/hgicon.png" type="image/png" />
712 <link rel="icon" href="/static/hgicon.png" type="image/png" />
713 <meta name="robots" content="index, nofollow"/>
713 <meta name="robots" content="index, nofollow"/>
714 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
714 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
715
715
716
716
717 <title>test: Graph</title>
717 <title>test: Graph</title>
718 <link rel="alternate" type="application/atom+xml"
718 <link rel="alternate" type="application/atom+xml"
719 href="/atom-log" title="Atom feed for test"/>
719 href="/atom-log" title="Atom feed for test"/>
720 <link rel="alternate" type="application/rss+xml"
720 <link rel="alternate" type="application/rss+xml"
721 href="/rss-log" title="RSS feed for test"/>
721 href="/rss-log" title="RSS feed for test"/>
722 <!--[if IE]><script type="text/javascript" src="/static/excanvas.js"></script><![endif]-->
722 <!--[if IE]><script type="text/javascript" src="/static/excanvas.js"></script><![endif]-->
723 </head>
723 </head>
724 <body>
724 <body>
725
725
726 <div class="page_header">
726 <div class="page_header">
727 <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / graph
727 <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / graph
728 </div>
728 </div>
729
729
730 <form action="/log">
730 <form action="/log">
731 <input type="hidden" name="style" value="gitweb" />
731 <input type="hidden" name="style" value="gitweb" />
732 <div class="search">
732 <div class="search">
733 <input type="text" name="rev" />
733 <input type="text" name="rev" />
734 </div>
734 </div>
735 </form>
735 </form>
736 <div class="page_nav">
736 <div class="page_nav">
737 <a href="/summary?style=gitweb">summary</a> |
737 <a href="/summary?style=gitweb">summary</a> |
738 <a href="/shortlog?style=gitweb">shortlog</a> |
738 <a href="/shortlog?style=gitweb">shortlog</a> |
739 <a href="/log/2?style=gitweb">changelog</a> |
739 <a href="/log/2?style=gitweb">changelog</a> |
740 graph |
740 graph |
741 <a href="/tags?style=gitweb">tags</a> |
741 <a href="/tags?style=gitweb">tags</a> |
742 <a href="/branches?style=gitweb">branches</a> |
742 <a href="/branches?style=gitweb">branches</a> |
743 <a href="/file/1d22e65f027e?style=gitweb">files</a>
743 <a href="/file/1d22e65f027e?style=gitweb">files</a>
744 <br/>
744 <br/>
745 <a href="/graph/2?style=gitweb&revcount=12">less</a>
745 <a href="/graph/2?style=gitweb&revcount=12">less</a>
746 <a href="/graph/2?style=gitweb&revcount=50">more</a>
746 <a href="/graph/2?style=gitweb&revcount=50">more</a>
747 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a> <br/>
747 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a> <br/>
748 </div>
748 </div>
749
749
750 <div class="title">&nbsp;</div>
750 <div class="title">&nbsp;</div>
751
751
752 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
752 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
753
753
754 <div id="wrapper">
754 <div id="wrapper">
755 <ul id="nodebgs"></ul>
755 <ul id="nodebgs"></ul>
756 <canvas id="graph" width="224" height="129"></canvas>
756 <canvas id="graph" width="224" height="129"></canvas>
757 <ul id="graphnodes"></ul>
757 <ul id="graphnodes"></ul>
758 </div>
758 </div>
759
759
760 <script type="text/javascript" src="/static/graph.js"></script>
760 <script type="text/javascript" src="/static/graph.js"></script>
761 <script>
761 <script>
762 <!-- hide script content
762 <!-- hide script content
763
763
764 var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "many years", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years", ["default", false], ["1.0"]]];
764 var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "many years", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years", ["default", false], ["1.0"]]];
765 var graph = new Graph();
765 var graph = new Graph();
766 graph.scale(39);
766 graph.scale(39);
767
767
768 graph.edge = function(x0, y0, x1, y1, color) {
768 graph.edge = function(x0, y0, x1, y1, color) {
769
769
770 this.setColor(color, 0.0, 0.65);
770 this.setColor(color, 0.0, 0.65);
771 this.ctx.beginPath();
771 this.ctx.beginPath();
772 this.ctx.moveTo(x0, y0);
772 this.ctx.moveTo(x0, y0);
773 this.ctx.lineTo(x1, y1);
773 this.ctx.lineTo(x1, y1);
774 this.ctx.stroke();
774 this.ctx.stroke();
775
775
776 }
776 }
777
777
778 var revlink = '<li style="_STYLE"><span class="desc">';
778 var revlink = '<li style="_STYLE"><span class="desc">';
779 revlink += '<a class="list" href="/rev/_NODEID?style=gitweb" title="_NODEID"><b>_DESC</b></a>';
779 revlink += '<a class="list" href="/rev/_NODEID?style=gitweb" title="_NODEID"><b>_DESC</b></a>';
780 revlink += '</span> _TAGS';
780 revlink += '</span> _TAGS';
781 revlink += '<span class="info">_DATE ago, by _USER</span></li>';
781 revlink += '<span class="info">_DATE ago, by _USER</span></li>';
782
782
783 graph.vertex = function(x, y, color, parity, cur) {
783 graph.vertex = function(x, y, color, parity, cur) {
784
784
785 this.ctx.beginPath();
785 this.ctx.beginPath();
786 color = this.setColor(color, 0.25, 0.75);
786 color = this.setColor(color, 0.25, 0.75);
787 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
787 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
788 this.ctx.fill();
788 this.ctx.fill();
789
789
790 var bg = '<li class="bg parity' + parity + '"></li>';
790 var bg = '<li class="bg parity' + parity + '"></li>';
791 var left = (this.columns + 1) * this.bg_height;
791 var left = (this.columns + 1) * this.bg_height;
792 var nstyle = 'padding-left: ' + left + 'px;';
792 var nstyle = 'padding-left: ' + left + 'px;';
793 var item = revlink.replace(/_STYLE/, nstyle);
793 var item = revlink.replace(/_STYLE/, nstyle);
794 item = item.replace(/_PARITY/, 'parity' + parity);
794 item = item.replace(/_PARITY/, 'parity' + parity);
795 item = item.replace(/_NODEID/, cur[0]);
795 item = item.replace(/_NODEID/, cur[0]);
796 item = item.replace(/_NODEID/, cur[0]);
796 item = item.replace(/_NODEID/, cur[0]);
797 item = item.replace(/_DESC/, cur[3]);
797 item = item.replace(/_DESC/, cur[3]);
798 item = item.replace(/_USER/, cur[4]);
798 item = item.replace(/_USER/, cur[4]);
799 item = item.replace(/_DATE/, cur[5]);
799 item = item.replace(/_DATE/, cur[5]);
800
800
801 var tagspan = '';
801 var tagspan = '';
802 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
802 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
803 tagspan = '<span class="logtags">';
803 tagspan = '<span class="logtags">';
804 if (cur[6][1]) {
804 if (cur[6][1]) {
805 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
805 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
806 tagspan += cur[6][0] + '</span> ';
806 tagspan += cur[6][0] + '</span> ';
807 } else if (!cur[6][1] && cur[6][0] != 'default') {
807 } else if (!cur[6][1] && cur[6][0] != 'default') {
808 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
808 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
809 tagspan += cur[6][0] + '</span> ';
809 tagspan += cur[6][0] + '</span> ';
810 }
810 }
811 if (cur[7].length) {
811 if (cur[7].length) {
812 for (var t in cur[7]) {
812 for (var t in cur[7]) {
813 var tag = cur[7][t];
813 var tag = cur[7][t];
814 tagspan += '<span class="tagtag">' + tag + '</span> ';
814 tagspan += '<span class="tagtag">' + tag + '</span> ';
815 }
815 }
816 }
816 }
817 tagspan += '</span>';
817 tagspan += '</span>';
818 }
818 }
819
819
820 item = item.replace(/_TAGS/, tagspan);
820 item = item.replace(/_TAGS/, tagspan);
821 return [bg, item];
821 return [bg, item];
822
822
823 }
823 }
824
824
825 graph.render(data);
825 graph.render(data);
826
826
827 // stop hiding script -->
827 // stop hiding script -->
828 </script>
828 </script>
829
829
830 <div class="page_nav">
830 <div class="page_nav">
831 <a href="/graph/2?style=gitweb&revcount=12">less</a>
831 <a href="/graph/2?style=gitweb&revcount=12">less</a>
832 <a href="/graph/2?style=gitweb&revcount=50">more</a>
832 <a href="/graph/2?style=gitweb&revcount=50">more</a>
833 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a>
833 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a>
834 </div>
834 </div>
835
835
836 <div class="page_footer">
836 <div class="page_footer">
837 <div class="page_footer_text">test</div>
837 <div class="page_footer_text">test</div>
838 <div class="rss_logo">
838 <div class="rss_logo">
839 <a href="/rss-log">RSS</a>
839 <a href="/rss-log">RSS</a>
840 <a href="/atom-log">Atom</a>
840 <a href="/atom-log">Atom</a>
841 </div>
841 </div>
842 <br />
842 <br />
843
843
844 </div>
844 </div>
845 </body>
845 </body>
846 </html>
846 </html>
847
847
848 % capabilities
848 % capabilities
849 200 Script output follows
849 200 Script output follows
850
850
851 lookup changegroupsubset unbundle=HG10GZ,HG10BZ,HG10UN% heads
851 lookup changegroupsubset branchmap unbundle=HG10GZ,HG10BZ,HG10UN% heads
852 200 Script output follows
852 200 Script output follows
853
853
854 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
854 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
855 % lookup
855 % lookup
856 200 Script output follows
856 200 Script output follows
857
857
858 0 'key'
858 0 'key'
859 % branches
859 % branches
860 200 Script output follows
860 200 Script output follows
861
861
862 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe 2ef0ac749a14e4f57a5a822464a0902c6f7f448f 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
862 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe 2ef0ac749a14e4f57a5a822464a0902c6f7f448f 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
863 % changegroup
863 % changegroup
864 200 Script output follows
864 200 Script output follows
865
865
866 x\x9c\xbdTMHUA\x14\xbe\xa8\xf9\xec\xda&\x10\x11*\xb8\x88\x81\x99\xbef\xe6\xce\xbdw\xc6\xf2a\x16E\x1b\x11[%\x98\xcc\xaf\x8f\x8c\xf7\xc0\xf7\x82
866 x\x9c\xbdTMHUA\x14\xbe\xa8\xf9\xec\xda&\x10\x11*\xb8\x88\x81\x99\xbef\xe6\xce\xbdw\xc6\xf2a\x16E\x1b\x11[%\x98\xcc\xaf\x8f\x8c\xf7\xc0\xf7\x82
867 4\x11KP2m\x95\xad*\xabE\x05AP\xd0\xc22Z\x14\xf9\x03\xb9j\xa3\x9b$\xa4MJ\xb4\x90\xc0\x9a\x9bO0\x10\xdf\x13\xa2\x81\x0f\x869g\xe6|\xe7\x9c\xef\x8ceY\xf7\xa2KO\xd2\xb7K\x16~\
867 4\x11KP2m\x95\xad*\xabE\x05AP\xd0\xc22Z\x14\xf9\x03\xb9j\xa3\x9b$\xa4MJ\xb4\x90\xc0\x9a\x9bO0\x10\xdf\x13\xa2\x81\x0f\x869g\xe6|\xe7\x9c\xef\x8ceY\xf7\xa2KO\xd2\xb7K\x16~\
868 \xe9\xad\x90w\x86\xab\x93W\x8e\xdf\xb0r\\Y\xee6(\xa2)\xf6\x95\xc6\x01\xe4\x1az\x80R\xe8kN\x98\xe7R\xa4\xa9K@\xe0!A\xb4k\xa7U*m\x03\x07\xd8\x92\x1d\xd2\xc9\xa4\x1d\xc2\xe6,\xa5\xcc+\x1f\xef\xafDgi\xef\xab\x1d\x1d\xb7\x9a\xe7[W\xfbc\x8f\xde-\xcd\xe7\xcaz\xb3\xbb\x19\xd3\x81\x10>c>\x08\x00"X\x11\xc2\x84@\xd2\xe7B*L\x00\x01P\x04R\xc3@\xbaB0\xdb8#\x83:\x83\xa2h\xbc=\xcd\xdaS\xe1Y,L\xd3\xa0\xf2\xa8\x94J:\xe6\xd8\x81Q\xe0\xe8d\xa7#\xe2,\xd1\xaeR*\xed \xa5\x01\x13\x01\xa6\x0cb\xe3;\xbe\xaf\xfcK[^wK\xe1N\xaf\xbbk\xe8B\xd1\xf4\xc1\x07\xb3\xab[\x10\xfdkmvwcB\xa6\xa4\xd4G\xc4D\xc2\x141\xad\x91\x10\x00\x08J\x81\xcb}\xee\t\xee+W\xba\x8a\x80\x90|\xd4\xa0\xd6\xa0\xd4T\xde\xe1\x9d,!\xe2\xb5\xa94\xe3\xe7\xd5\x9f\x06\x18\xcba\x03aP\xb8f\xcd\x04\x1a_\\9\xf1\xed\xe4\x9e\xe5\xa6\xd1\xd2\x9f\x03\xa7o\xae\x90H\xf3\xfb\xef\xffH3\xadk
868 \xe9\xad\x90w\x86\xab\x93W\x8e\xdf\xb0r\\Y\xee6(\xa2)\xf6\x95\xc6\x01\xe4\x1az\x80R\xe8kN\x98\xe7R\xa4\xa9K@\xe0!A\xb4k\xa7U*m\x03\x07\xd8\x92\x1d\xd2\xc9\xa4\x1d\xc2\xe6,\xa5\xcc+\x1f\xef\xafDgi\xef\xab\x1d\x1d\xb7\x9a\xe7[W\xfbc\x8f\xde-\xcd\xe7\xcaz\xb3\xbb\x19\xd3\x81\x10>c>\x08\x00"X\x11\xc2\x84@\xd2\xe7B*L\x00\x01P\x04R\xc3@\xbaB0\xdb8#\x83:\x83\xa2h\xbc=\xcd\xdaS\xe1Y,L\xd3\xa0\xf2\xa8\x94J:\xe6\xd8\x81Q\xe0\xe8d\xa7#\xe2,\xd1\xaeR*\xed \xa5\x01\x13\x01\xa6\x0cb\xe3;\xbe\xaf\xfcK[^wK\xe1N\xaf\xbbk\xe8B\xd1\xf4\xc1\x07\xb3\xab[\x10\xfdkmvwcB\xa6\xa4\xd4G\xc4D\xc2\x141\xad\x91\x10\x00\x08J\x81\xcb}\xee\t\xee+W\xba\x8a\x80\x90|\xd4\xa0\xd6\xa0\xd4T\xde\xe1\x9d,!\xe2\xb5\xa94\xe3\xe7\xd5\x9f\x06\x18\xcba\x03aP\xb8f\xcd\x04\x1a_\\9\xf1\xed\xe4\x9e\xe5\xa6\xd1\xd2\x9f\x03\xa7o\xae\x90H\xf3\xfb\xef\xffH3\xadk
869 \xb0\x90\x92\x88\xb9\x14"\x068\xc2\x1e@\x00\xbb\x8a)\xd3\'\x859
869 \xb0\x90\x92\x88\xb9\x14"\x068\xc2\x1e@\x00\xbb\x8a)\xd3\'\x859
870 \xa8\x80\x84S \xa5\xbd-g\x13`\xe4\xdc\xc3H^\xdf\xe2\xc0TM\xc7\xf4BO\xcf\xde\xae\xe5\xae#\x1frM(K\x97`F\x19\x16s\x05GD\xb9\x01\xc1\x00+\x8c|\x9fp\xc11\xf0\x14\x00\x9cJ\x82<\xe0\x12\x9f\xc1\x90\xd0\xf5\xc8\x19>Pr\xaa\xeaW\xf5\xc4\xae\xd1\xfc\x17\xcf\'\x13u\xb1\x9e\xcdHnC\x0e\xcc`\xc8\xa0&\xac\x0e\xf1|\x8c\x10$\xc4\x8c\xa2p\x05`\xdc\x08 \x80\xc4\xd7Rr-\x94\x10\x102\xedi;\xf3f\xf1z\x16\x86\xdb\xd8d\xe5\xe7\x8b\xf5\x8d\rzp\xb2\xfe\xac\xf5\xf2\xd3\xfe\xfckws\xedt\x96b\xd5l\x1c\x0b\x85\xb5\x170\x8f\x11\x84\xb0\x8f\x19\xa0\x00\t_\x07\x1ac\xa2\xc3\x89Z\xe7\x96\xf9 \xccNFg\xc7F\xaa\x8a+\x9a\x9cc_\x17\x1b\x17\x9e]z38<\x97+\xb5,",\xc8\xc8?\\\x91\xff\x17.~U\x96\x97\xf5%\xdeN<\x8e\xf5\x97%\xe7^\xcfL\xed~\xda\x96k\xdc->\x86\x02\x83"\x96H\xa6\xe3\xaas=-\xeb7\xe5\xda\x8f\xbc
870 \xa8\x80\x84S \xa5\xbd-g\x13`\xe4\xdc\xc3H^\xdf\xe2\xc0TM\xc7\xf4BO\xcf\xde\xae\xe5\xae#\x1frM(K\x97`F\x19\x16s\x05GD\xb9\x01\xc1\x00+\x8c|\x9fp\xc11\xf0\x14\x00\x9cJ\x82<\xe0\x12\x9f\xc1\x90\xd0\xf5\xc8\x19>Pr\xaa\xeaW\xf5\xc4\xae\xd1\xfc\x17\xcf\'\x13u\xb1\x9e\xcdHnC\x0e\xcc`\xc8\xa0&\xac\x0e\xf1|\x8c\x10$\xc4\x8c\xa2p\x05`\xdc\x08 \x80\xc4\xd7Rr-\x94\x10\x102\xedi;\xf3f\xf1z\x16\x86\xdb\xd8d\xe5\xe7\x8b\xf5\x8d\rzp\xb2\xfe\xac\xf5\xf2\xd3\xfe\xfckws\xedt\x96b\xd5l\x1c\x0b\x85\xb5\x170\x8f\x11\x84\xb0\x8f\x19\xa0\x00\t_\x07\x1ac\xa2\xc3\x89Z\xe7\x96\xf9 \xccNFg\xc7F\xaa\x8a+\x9a\x9cc_\x17\x1b\x17\x9e]z38<\x97+\xb5,",\xc8\xc8?\\\x91\xff\x17.~U\x96\x97\xf5%\xdeN<\x8e\xf5\x97%\xe7^\xcfL\xed~\xda\x96k\xdc->\x86\x02\x83"\x96H\xa6\xe3\xaas=-\xeb7\xe5\xda\x8f\xbc
871 % stream_out
871 % stream_out
872 200 Script output follows
872 200 Script output follows
873
873
874 1
874 1
875 % failing unbundle, requires POST request
875 % failing unbundle, requires POST request
876 405 Method Not Allowed
876 405 Method Not Allowed
877
877
878 0
878 0
879 push requires POST request
879 push requires POST request
880 % Static files
880 % Static files
881 200 Script output follows
881 200 Script output follows
882
882
883 a { text-decoration:none; }
883 a { text-decoration:none; }
884 .age { white-space:nowrap; }
884 .age { white-space:nowrap; }
885 .date { white-space:nowrap; }
885 .date { white-space:nowrap; }
886 .indexlinks { white-space:nowrap; }
886 .indexlinks { white-space:nowrap; }
887 .parity0 { background-color: #ddd; }
887 .parity0 { background-color: #ddd; }
888 .parity1 { background-color: #eee; }
888 .parity1 { background-color: #eee; }
889 .lineno { width: 60px; color: #aaa; font-size: smaller;
889 .lineno { width: 60px; color: #aaa; font-size: smaller;
890 text-align: right; }
890 text-align: right; }
891 .plusline { color: green; }
891 .plusline { color: green; }
892 .minusline { color: red; }
892 .minusline { color: red; }
893 .atline { color: purple; }
893 .atline { color: purple; }
894 .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
894 .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
895 .buttons a {
895 .buttons a {
896 background-color: #666;
896 background-color: #666;
897 padding: 2pt;
897 padding: 2pt;
898 color: white;
898 color: white;
899 font-family: sans;
899 font-family: sans;
900 font-weight: bold;
900 font-weight: bold;
901 }
901 }
902 .navigate a {
902 .navigate a {
903 background-color: #ccc;
903 background-color: #ccc;
904 padding: 2pt;
904 padding: 2pt;
905 font-family: sans;
905 font-family: sans;
906 color: black;
906 color: black;
907 }
907 }
908
908
909 .metatag {
909 .metatag {
910 background-color: #888;
910 background-color: #888;
911 color: white;
911 color: white;
912 text-align: right;
912 text-align: right;
913 }
913 }
914
914
915 /* Common */
915 /* Common */
916 pre { margin: 0; }
916 pre { margin: 0; }
917
917
918 .logo {
918 .logo {
919 float: right;
919 float: right;
920 clear: right;
920 clear: right;
921 }
921 }
922
922
923 /* Changelog/Filelog entries */
923 /* Changelog/Filelog entries */
924 .logEntry { width: 100%; }
924 .logEntry { width: 100%; }
925 .logEntry .age { width: 15%; }
925 .logEntry .age { width: 15%; }
926 .logEntry th { font-weight: normal; text-align: right; vertical-align: top; }
926 .logEntry th { font-weight: normal; text-align: right; vertical-align: top; }
927 .logEntry th.age, .logEntry th.firstline { font-weight: bold; }
927 .logEntry th.age, .logEntry th.firstline { font-weight: bold; }
928 .logEntry th.firstline { text-align: left; width: inherit; }
928 .logEntry th.firstline { text-align: left; width: inherit; }
929
929
930 /* Shortlog entries */
930 /* Shortlog entries */
931 .slogEntry { width: 100%; }
931 .slogEntry { width: 100%; }
932 .slogEntry .age { width: 8em; }
932 .slogEntry .age { width: 8em; }
933 .slogEntry td { font-weight: normal; text-align: left; vertical-align: top; }
933 .slogEntry td { font-weight: normal; text-align: left; vertical-align: top; }
934 .slogEntry td.author { width: 15em; }
934 .slogEntry td.author { width: 15em; }
935
935
936 /* Tag entries */
936 /* Tag entries */
937 #tagEntries { list-style: none; margin: 0; padding: 0; }
937 #tagEntries { list-style: none; margin: 0; padding: 0; }
938 #tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; }
938 #tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; }
939
939
940 /* Changeset entry */
940 /* Changeset entry */
941 #changesetEntry { }
941 #changesetEntry { }
942 #changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
942 #changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
943 #changesetEntry th.files, #changesetEntry th.description { vertical-align: top; }
943 #changesetEntry th.files, #changesetEntry th.description { vertical-align: top; }
944
944
945 /* File diff view */
945 /* File diff view */
946 #filediffEntry { }
946 #filediffEntry { }
947 #filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
947 #filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
948
948
949 /* Graph */
949 /* Graph */
950 div#wrapper {
950 div#wrapper {
951 position: relative;
951 position: relative;
952 margin: 0;
952 margin: 0;
953 padding: 0;
953 padding: 0;
954 }
954 }
955
955
956 canvas {
956 canvas {
957 position: absolute;
957 position: absolute;
958 z-index: 5;
958 z-index: 5;
959 top: -0.6em;
959 top: -0.6em;
960 margin: 0;
960 margin: 0;
961 }
961 }
962
962
963 ul#nodebgs {
963 ul#nodebgs {
964 list-style: none inside none;
964 list-style: none inside none;
965 padding: 0;
965 padding: 0;
966 margin: 0;
966 margin: 0;
967 top: -0.7em;
967 top: -0.7em;
968 }
968 }
969
969
970 ul#graphnodes li, ul#nodebgs li {
970 ul#graphnodes li, ul#nodebgs li {
971 height: 39px;
971 height: 39px;
972 }
972 }
973
973
974 ul#graphnodes {
974 ul#graphnodes {
975 position: absolute;
975 position: absolute;
976 z-index: 10;
976 z-index: 10;
977 top: -0.85em;
977 top: -0.85em;
978 list-style: none inside none;
978 list-style: none inside none;
979 padding: 0;
979 padding: 0;
980 }
980 }
981
981
982 ul#graphnodes li .info {
982 ul#graphnodes li .info {
983 display: block;
983 display: block;
984 font-size: 70%;
984 font-size: 70%;
985 position: relative;
985 position: relative;
986 top: -1px;
986 top: -1px;
987 }
987 }
988 % ERRORS ENCOUNTERED
988 % ERRORS ENCOUNTERED
General Comments 0
You need to be logged in to leave comments. Login now