##// END OF EJS Templates
merge with stable
Martin Geisler -
r9222:50cf61eb merge default
parent child Browse files
Show More
@@ -103,7 +103,9 b' def show_doc(ui):'
103 underlined(gettext(section).upper())
103 underlined(gettext(section).upper())
104 if callable(doc):
104 if callable(doc):
105 doc = doc()
105 doc = doc()
106 ui.write(gettext(doc))
106 else:
107 doc = gettext(doc)
108 ui.write(doc)
107 ui.write("\n")
109 ui.write("\n")
108
110
109 if __name__ == "__main__":
111 if __name__ == "__main__":
@@ -84,7 +84,7 b' def hook(ui, repo, hooktype, node=None, '
84 if source == 'serve' and 'url' in kwargs:
84 if source == 'serve' and 'url' in kwargs:
85 url = kwargs['url'].split(':')
85 url = kwargs['url'].split(':')
86 if url[0] == 'remote' and url[1].startswith('http'):
86 if url[0] == 'remote' and url[1].startswith('http'):
87 user = urllib.unquote(url[2])
87 user = urllib.unquote(url[3])
88
88
89 if user is None:
89 if user is None:
90 user = getpass.getuser()
90 user = getpass.getuser()
@@ -282,7 +282,9 b' class convert_cvs(converter_source):'
282 self.writep.flush()
282 self.writep.flush()
283 r = self.readp.readline()
283 r = self.readp.readline()
284 if not r.startswith("Valid-requests"):
284 if not r.startswith("Valid-requests"):
285 raise util.Abort(_("server sucks"))
285 raise util.Abort(_("unexpected response from CVS server "
286 "(expected \"Valid-requests\", but got %r)")
287 % r)
286 if "UseUnchanged" in r:
288 if "UseUnchanged" in r:
287 self.writep.write("UseUnchanged\n")
289 self.writep.write("UseUnchanged\n")
288 self.writep.flush()
290 self.writep.flush()
@@ -459,13 +459,14 b' def reposetup(ui, repo):'
459 data = super(kwrepo, self).wread(filename)
459 data = super(kwrepo, self).wread(filename)
460 return kwt.wread(filename, data)
460 return kwt.wread(filename, data)
461
461
462 def commit(self, text='', user=None, date=None, match=None,
462 def commit(self, *args, **opts):
463 force=False, editor=None, extra={}):
464 # use custom commitctx for user commands
463 # use custom commitctx for user commands
465 # other extensions can still wrap repo.commitctx directly
464 # other extensions can still wrap repo.commitctx directly
466 repo.commitctx = self.kwcommitctx
465 self.commitctx = self.kwcommitctx
467 return super(kwrepo, self).commit(text, user, date, match, force,
466 try:
468 editor, extra)
467 return super(kwrepo, self).commit(*args, **opts)
468 finally:
469 del self.commitctx
469
470
470 def kwcommitctx(self, ctx, error=False):
471 def kwcommitctx(self, ctx, error=False):
471 wlock = lock = None
472 wlock = lock = None
@@ -489,7 +490,7 b' def reposetup(ui, repo):'
489 if commithooks:
490 if commithooks:
490 for name, cmd in commithooks.iteritems():
491 for name, cmd in commithooks.iteritems():
491 ui.setconfig('hooks', name, cmd)
492 ui.setconfig('hooks', name, cmd)
492 repo.hook('commit', node=n, parent1=xp1, parent2=xp2)
493 self.hook('commit', node=n, parent1=xp1, parent2=xp2)
493 return n
494 return n
494 finally:
495 finally:
495 release(lock, wlock)
496 release(lock, wlock)
@@ -38,7 +38,7 b' encoding.encoding which is decided by Me'
38 setting or HGENCODING.
38 setting or HGENCODING.
39 '''
39 '''
40
40
41 import os
41 import os, sys
42 from mercurial.i18n import _
42 from mercurial.i18n import _
43 from mercurial import util, encoding
43 from mercurial import util, encoding
44
44
@@ -79,10 +79,8 b' def wrapper(func, args):'
79 " %s encoding\n") % (encoding.encoding))
79 " %s encoding\n") % (encoding.encoding))
80
80
81 def wrapname(name):
81 def wrapname(name):
82 idx = name.rfind('.')
82 module, name = name.rsplit('.', 1)
83 module = name[:idx]
83 module = sys.modules[module]
84 name = name[idx+1:]
85 module = globals()[module]
86 func = getattr(module, name)
84 func = getattr(module, name)
87 def f(*args):
85 def f(*args):
88 return wrapper(func, args)
86 return wrapper(func, args)
@@ -97,7 +95,8 b' def wrapname(name):'
97 # they use result of os.path.split()
95 # they use result of os.path.split()
98 funcs = '''os.path.join os.path.split os.path.splitext
96 funcs = '''os.path.join os.path.split os.path.splitext
99 os.path.splitunc os.path.normpath os.path.normcase os.makedirs
97 os.path.splitunc os.path.normpath os.path.normcase os.makedirs
100 util.endswithsep util.splitpath util.checkcase util.fspath'''
98 mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase
99 mercurial.util.fspath mercurial.windows.pconvert'''
101
100
102 # codec and alias names of sjis and big5 to be faked.
101 # codec and alias names of sjis and big5 to be faked.
103 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
102 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
@@ -242,7 +242,10 b' def expandpats(pats):'
242 for p in pats:
242 for p in pats:
243 kind, name = _match._patsplit(p, None)
243 kind, name = _match._patsplit(p, None)
244 if kind is None:
244 if kind is None:
245 globbed = glob.glob(name)
245 try:
246 globbed = glob.glob(name)
247 except re.error:
248 globbed = [name]
246 if globbed:
249 if globbed:
247 ret.extend(globbed)
250 ret.extend(globbed)
248 continue
251 continue
@@ -1206,18 +1206,7 b' def grep(ui, repo, pattern, *pats, **opt'
1206 if opts.get('print0'):
1206 if opts.get('print0'):
1207 sep = eol = '\0'
1207 sep = eol = '\0'
1208
1208
1209 fcache = {}
1209 getfile = util.lrucachefunc(repo.file)
1210 forder = []
1211 def getfile(fn):
1212 if fn not in fcache:
1213 if len(fcache) > 20:
1214 del fcache[forder.pop(0)]
1215 fcache[fn] = repo.file(fn)
1216 else:
1217 forder.remove(fn)
1218
1219 forder.append(fn)
1220 return fcache[fn]
1221
1210
1222 def matchlines(body):
1211 def matchlines(body):
1223 begin = 0
1212 begin = 0
@@ -291,6 +291,7 b' class filectx(object):'
291
291
292 def linkrev(self): return self._filelog.linkrev(self._filerev)
292 def linkrev(self): return self._filelog.linkrev(self._filerev)
293 def node(self): return self._changectx.node()
293 def node(self): return self._changectx.node()
294 def hex(self): return hex(self.node())
294 def user(self): return self._changectx.user()
295 def user(self): return self._changectx.user()
295 def date(self): return self._changectx.date()
296 def date(self): return self._changectx.date()
296 def files(self): return self._changectx.files()
297 def files(self): return self._changectx.files()
@@ -379,11 +380,11 b' class filectx(object):'
379 child[0][b1:b2] = parent[0][a1:a2]
380 child[0][b1:b2] = parent[0][a1:a2]
380 return child
381 return child
381
382
382 getlog = util.cachefunc(lambda x: self._repo.file(x))
383 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
383 def getctx(path, fileid):
384 def getctx(path, fileid):
384 log = path == self._path and self._filelog or getlog(path)
385 log = path == self._path and self._filelog or getlog(path)
385 return filectx(self._repo, path, fileid=fileid, filelog=log)
386 return filectx(self._repo, path, fileid=fileid, filelog=log)
386 getctx = util.cachefunc(getctx)
387 getctx = util.lrucachefunc(getctx)
387
388
388 def parents(f):
389 def parents(f):
389 # we want to reuse filectx objects as much as possible
390 # we want to reuse filectx objects as much as possible
@@ -120,8 +120,8 b' def copies(repo, c1, c2, ca, checkdirs=F'
120 return c1.filectx(f)
120 return c1.filectx(f)
121 return c2.filectx(f)
121 return c2.filectx(f)
122 return repo.filectx(f, fileid=n)
122 return repo.filectx(f, fileid=n)
123 ctx = util.cachefunc(makectx)
124
123
124 ctx = util.lrucachefunc(makectx)
125 copy = {}
125 copy = {}
126 fullcopy = {}
126 fullcopy = {}
127 diverge = {}
127 diverge = {}
@@ -449,17 +449,19 b' PYTHONPATH::'
449 _(r'''
449 _(r'''
450 Valid URLs are of the form:
450 Valid URLs are of the form:
451
451
452 local/filesystem/path (or file://local/filesystem/path)
452 local/filesystem/path[#revision]
453 http://[user[:pass]@]host[:port]/[path]
453 file://local/filesystem/path[#revision]
454 https://[user[:pass]@]host[:port]/[path]
454 http://[user[:pass]@]host[:port]/[path][#revision]
455 ssh://[user[:pass]@]host[:port]/[path]
455 https://[user[:pass]@]host[:port]/[path][#revision]
456 ssh://[user[:pass]@]host[:port]/[path][#revision]
456
457
457 Paths in the local filesystem can either point to Mercurial
458 Paths in the local filesystem can either point to Mercurial
458 repositories or to bundle files (as created by 'hg bundle' or
459 repositories or to bundle files (as created by 'hg bundle' or
459 'hg incoming --bundle').
460 'hg incoming --bundle').
460
461
461 An optional identifier after # indicates a particular branch, tag,
462 An optional identifier after # indicates a particular branch, tag,
462 or changeset to use from the remote repository.
463 or changeset to use from the remote repository. See also 'hg help
464 revisions'.
463
465
464 Some features, such as pushing to http:// and https:// URLs are
466 Some features, such as pushing to http:// and https:// URLs are
465 only possible if the feature is explicitly enabled on the remote
467 only possible if the feature is explicitly enabled on the remote
@@ -473,7 +473,9 b' class localrepository(repo.repository):'
473 latest = newnodes.pop()
473 latest = newnodes.pop()
474 if latest not in bheads:
474 if latest not in bheads:
475 continue
475 continue
476 reachable = self.changelog.reachable(latest, bheads[0])
476 reachable = set()
477 for bh in bheads:
478 reachable |= self.changelog.reachable(latest, bh)
477 bheads = [b for b in bheads if b not in reachable]
479 bheads = [b for b in bheads if b not in reachable]
478 newbheads.insert(0, latest)
480 newbheads.insert(0, latest)
479 bheads.extend(newbheads)
481 bheads.extend(newbheads)
@@ -35,7 +35,7 b' def _playback(journal, report, opener, e'
35 try:
35 try:
36 fn = opener(f).name
36 fn = opener(f).name
37 os.unlink(fn)
37 os.unlink(fn)
38 except OSError, inst:
38 except IOError, inst:
39 if inst.errno != errno.ENOENT:
39 if inst.errno != errno.ENOENT:
40 raise
40 raise
41 os.unlink(journal)
41 os.unlink(journal)
@@ -441,6 +441,7 b' if has_https:'
441 # let host port take precedence
441 # let host port take precedence
442 if ':' in host and '[' not in host or ']:' in host:
442 if ':' in host and '[' not in host or ']:' in host:
443 host, port = host.rsplit(':', 1)
443 host, port = host.rsplit(':', 1)
444 port = int(port)
444 if '[' in host:
445 if '[' in host:
445 host = host[1:-1]
446 host = host[1:-1]
446
447
@@ -39,11 +39,16 b' def _fastsha1(s):'
39 import subprocess
39 import subprocess
40 closefds = os.name == 'posix'
40 closefds = os.name == 'posix'
41 def popen2(cmd):
41 def popen2(cmd):
42 p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
42 # Setting bufsize to -1 lets the system decide the buffer size.
43 # The default for bufsize is 0, meaning unbuffered. This leads to
44 # poor performance on Mac OS X: http://bugs.python.org/issue4194
45 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
46 close_fds=closefds,
43 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
47 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
44 return p.stdin, p.stdout
48 return p.stdin, p.stdout
45 def popen3(cmd):
49 def popen3(cmd):
46 p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
50 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
51 close_fds=closefds,
47 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
52 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
48 stderr=subprocess.PIPE)
53 stderr=subprocess.PIPE)
49 return p.stdin, p.stdout, p.stderr
54 return p.stdin, p.stdout, p.stderr
@@ -110,6 +115,33 b' def cachefunc(func):'
110
115
111 return f
116 return f
112
117
118 def lrucachefunc(func):
119 '''cache most recent results of function calls'''
120 cache = {}
121 order = []
122 if func.func_code.co_argcount == 1:
123 def f(arg):
124 if arg not in cache:
125 if len(cache) > 20:
126 del cache[order.pop(0)]
127 cache[arg] = func(arg)
128 else:
129 order.remove(arg)
130 order.append(arg)
131 return cache[arg]
132 else:
133 def f(*args):
134 if args not in cache:
135 if len(cache) > 20:
136 del cache[order.pop(0)]
137 cache[args] = func(*args)
138 else:
139 order.remove(args)
140 order.append(args)
141 return cache[args]
142
143 return f
144
113 class propertycache(object):
145 class propertycache(object):
114 def __init__(self, func):
146 def __init__(self, func):
115 self.func = func
147 self.func = func
@@ -209,11 +209,9 b' def statfiles(files):'
209 dircache = {} # dirname -> filename -> status | None if file does not exist
209 dircache = {} # dirname -> filename -> status | None if file does not exist
210 for nf in files:
210 for nf in files:
211 nf = ncase(nf)
211 nf = ncase(nf)
212 pos = nf.rfind(sep)
212 dir, base = os.path.split(nf)
213 if pos == -1:
213 if not dir:
214 dir, base = '.', nf
214 dir = '.'
215 else:
216 dir, base = nf[:pos+1], nf[pos+1:]
217 cache = dircache.get(dir, None)
215 cache = dircache.get(dir, None)
218 if cache is None:
216 if cache is None:
219 try:
217 try:
@@ -72,9 +72,7 b' filediff = filediff.tmpl'
72 filelog = filelog.tmpl
72 filelog = filelog.tmpl
73 fileline = '
73 fileline = '
74 <div style="font-family:monospace" class="parity{parity}">
74 <div style="font-family:monospace" class="parity{parity}">
75 <pre>
75 <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre>
76 <a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}
77 </pre>
78 </div>'
76 </div>'
79 annotateline = '
77 annotateline = '
80 <tr style="font-family:monospace" class="parity{parity}">
78 <tr style="font-family:monospace" class="parity{parity}">
@@ -63,9 +63,7 b' filediff = filediff.tmpl'
63 filelog = filelog.tmpl
63 filelog = filelog.tmpl
64 fileline = '
64 fileline = '
65 <div style="font-family:monospace" class="parity{parity}">
65 <div style="font-family:monospace" class="parity{parity}">
66 <pre>
66 <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre>
67 <a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}
68 </pre>
69 </div>'
67 </div>'
70 annotateline = '
68 annotateline = '
71 <tr class="parity{parity}">
69 <tr class="parity{parity}">
@@ -2,7 +2,7 b''
2
2
3 "$TESTDIR/hghave" bzr || exit 80
3 "$TESTDIR/hghave" bzr || exit 80
4
4
5 export TERM=dumb
5 TERM=dumb; export TERM
6 echo '[extensions]' >> $HGRCPATH
6 echo '[extensions]' >> $HGRCPATH
7 echo 'convert = ' >> $HGRCPATH
7 echo 'convert = ' >> $HGRCPATH
8 echo 'hgext.graphlog = ' >> $HGRCPATH
8 echo 'hgext.graphlog = ' >> $HGRCPATH
@@ -6,12 +6,12 b' echo "[extensions]" >> $HGRCPATH'
6 echo "convert = " >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
7
7
8 echo % create p4 depot
8 echo % create p4 depot
9 export P4ROOT=$PWD/depot
9 P4ROOT=`pwd`/depot; export P4ROOT
10 export P4AUDIT=$P4ROOT/audit
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT
11 export P4JOURNAL=$P4ROOT/journal
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
12 export P4LOG=$P4ROOT/log
12 P4LOG=$P4ROOT/log; export P4LOG
13 export P4PORT=localhost:16661
13 P4PORT=localhost:16661; export P4PORT
14 export P4DEBUG=1
14 P4DEBUG=1; export P4DEBUG
15
15
16 echo % start the p4 server
16 echo % start the p4 server
17 [ ! -d $P4ROOT ] && mkdir $P4ROOT
17 [ ! -d $P4ROOT ] && mkdir $P4ROOT
@@ -24,7 +24,7 b' while ! p4 ; do'
24 done >/dev/null 2>/dev/null
24 done >/dev/null 2>/dev/null
25
25
26 echo % create a client spec
26 echo % create a client spec
27 export P4CLIENT=hg-p4-import
27 P4CLIENT=hg-p4-import; export P4CLIENT
28 DEPOTPATH=//depot/test-mercurial-import/...
28 DEPOTPATH=//depot/test-mercurial-import/...
29 p4 client -o | sed '/^View:/,$ d' >p4client
29 p4 client -o | sed '/^View:/,$ d' >p4client
30 echo View: >>p4client
30 echo View: >>p4client
@@ -6,13 +6,13 b' echo "[extensions]" >> $HGRCPATH'
6 echo "convert = " >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
7
7
8 echo % create p4 depot
8 echo % create p4 depot
9 export P4ROOT=$PWD/depot
9 P4ROOT=$PWD/depot; export P4ROOT
10 export P4AUDIT=$P4ROOT/audit
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT
11 export P4JOURNAL=$P4ROOT/journal
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
12 export P4LOG=$P4ROOT/log
12 P4LOG=$P4ROOT/log; export P4LOG
13 export P4PORT=localhost:16661
13 P4PORT=localhost:16661; export P4PORT
14 export P4DEBUG=1
14 P4DEBUG=1; export P4DEBUG
15 export P4CHARSET=utf8
15 P4CHARSET=utf8; export P4CHARSET
16
16
17 echo % start the p4 server
17 echo % start the p4 server
18 [ ! -d $P4ROOT ] && mkdir $P4ROOT
18 [ ! -d $P4ROOT ] && mkdir $P4ROOT
@@ -26,7 +26,7 b' while ! p4 ; do'
26 done >/dev/null 2>/dev/null
26 done >/dev/null 2>/dev/null
27
27
28 echo % create a client spec
28 echo % create a client spec
29 export P4CLIENT=hg-p4-import
29 P4CLIENT=hg-p4-import; export P4CLIENT
30 DEPOTPATH=//depot/test-mercurial-import/...
30 DEPOTPATH=//depot/test-mercurial-import/...
31 p4 client -o | sed '/^View:/,$ d' >p4client
31 p4 client -o | sed '/^View:/,$ d' >p4client
32 echo View: >>p4client
32 echo View: >>p4client
@@ -185,6 +185,18 b' echo % fetch should succeed'
185 hg --cwd ib2 fetch ../ib1
185 hg --cwd ib2 fetch ../ib1
186 rm -fr ib1 ib2
186 rm -fr ib1 ib2
187
187
188 echo % test issue1726
189 hg init i1726r1
190 echo a > i1726r1/a
191 hg --cwd i1726r1 ci -Am base
192 hg clone i1726r1 i1726r2
193 echo b > i1726r1/a
194 hg --cwd i1726r1 ci -m second
195 echo c > i1726r2/a
196 hg --cwd i1726r2 ci -m third
197 HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | sed 's/new changeset 3:[0-9a-zA-Z]\+/new changeset 3/'
198 hg --cwd i1726r2 heads default --template '{rev}\n'
199
188 "$TESTDIR/killdaemons.py"
200 "$TESTDIR/killdaemons.py"
189
201
190 true
202 true
@@ -190,3 +190,20 b' 3 files updated, 0 files merged, 0 files'
190 pulling from ../ib1
190 pulling from ../ib1
191 searching for changes
191 searching for changes
192 no changes found
192 no changes found
193 % test issue1726
194 adding a
195 updating working directory
196 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
197 pulling from ../i1726r1
198 searching for changes
199 adding changesets
200 adding manifests
201 adding file changes
202 added 1 changesets with 1 changes to 1 files (+1 heads)
203 updating to 2:7837755a2789
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 merging with 1:d1f0c6c48ebd
206 merging a
207 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
208 new changeset 3 merges remote changes with local
209 3
@@ -20,7 +20,7 b' EOF'
20
20
21 hg init test
21 hg init test
22 echo '[extensions]' > test/.hg/hgrc
22 echo '[extensions]' > test/.hg/hgrc
23 echo "engine = $PWD/engine.py" >> test/.hg/hgrc
23 echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
24
24
25 cd test
25 cd test
26 cat > mymap << EOF
26 cat > mymap << EOF
General Comments 0
You need to be logged in to leave comments. Login now