##// END OF EJS Templates
Merge with stable
Matt Mackall -
r9102:bbc78cb1 merge default
parent child Browse files
Show More
@@ -456,13 +456,14 b' def reposetup(ui, repo):'
456 456 data = super(kwrepo, self).wread(filename)
457 457 return kwt.wread(filename, data)
458 458
459 def commit(self, text='', user=None, date=None, match=None,
460 force=False, editor=None, extra={}):
459 def commit(self, *args, **opts):
461 460 # use custom commitctx for user commands
462 461 # other extensions can still wrap repo.commitctx directly
463 repo.commitctx = self.kwcommitctx
464 return super(kwrepo, self).commit(text, user, date, match, force,
465 editor, extra)
462 self.commitctx = self.kwcommitctx
463 try:
464 return super(kwrepo, self).commit(*args, **opts)
465 finally:
466 del self.commitctx
466 467
467 468 def kwcommitctx(self, ctx, error=False):
468 469 wlock = lock = None
@@ -486,7 +487,7 b' def reposetup(ui, repo):'
486 487 if commithooks:
487 488 for name, cmd in commithooks.iteritems():
488 489 ui.setconfig('hooks', name, cmd)
489 repo.hook('commit', node=n, parent1=xp1, parent2=xp2)
490 self.hook('commit', node=n, parent1=xp1, parent2=xp2)
490 491 return n
491 492 finally:
492 493 release(lock, wlock)
@@ -35,7 +35,7 b' Path encoding conversion are done betwee'
35 35 is decided by Mercurial from current locale setting or HGENCODING.
36 36 '''
37 37
38 import os
38 import os, sys
39 39 from mercurial.i18n import _
40 40 from mercurial import util, encoding
41 41
@@ -76,10 +76,8 b' def wrapper(func, args):'
76 76 " %s encoding\n") % (encoding.encoding))
77 77
78 78 def wrapname(name):
79 idx = name.rfind('.')
80 module = name[:idx]
81 name = name[idx+1:]
82 module = globals()[module]
79 module, name = name.rsplit('.', 1)
80 module = sys.modules[module]
83 81 func = getattr(module, name)
84 82 def f(*args):
85 83 return wrapper(func, args)
@@ -94,7 +92,8 b' def wrapname(name):'
94 92 # they use result of os.path.split()
95 93 funcs = '''os.path.join os.path.split os.path.splitext
96 94 os.path.splitunc os.path.normpath os.path.normcase os.makedirs
97 util.endswithsep util.splitpath util.checkcase util.fspath'''
95 mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase
96 mercurial.util.fspath mercurial.windows.pconvert'''
98 97
99 98 # codec and alias names of sjis and big5 to be faked.
100 99 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
@@ -1183,18 +1183,7 b' def grep(ui, repo, pattern, *pats, **opt'
1183 1183 if opts.get('print0'):
1184 1184 sep = eol = '\0'
1185 1185
1186 fcache = {}
1187 forder = []
1188 def getfile(fn):
1189 if fn not in fcache:
1190 if len(fcache) > 20:
1191 del fcache[forder.pop(0)]
1192 fcache[fn] = repo.file(fn)
1193 else:
1194 forder.remove(fn)
1195
1196 forder.append(fn)
1197 return fcache[fn]
1186 getfile = util.lrucachefunc(repo.file)
1198 1187
1199 1188 def matchlines(body):
1200 1189 begin = 0
@@ -293,6 +293,7 b' class filectx(object):'
293 293
294 294 def linkrev(self): return self._filelog.linkrev(self._filerev)
295 295 def node(self): return self._changectx.node()
296 def hex(self): return hex(self.node())
296 297 def user(self): return self._changectx.user()
297 298 def date(self): return self._changectx.date()
298 299 def files(self): return self._changectx.files()
@@ -381,11 +382,11 b' class filectx(object):'
381 382 child[0][b1:b2] = parent[0][a1:a2]
382 383 return child
383 384
384 getlog = util.cachefunc(lambda x: self._repo.file(x))
385 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
385 386 def getctx(path, fileid):
386 387 log = path == self._path and self._filelog or getlog(path)
387 388 return filectx(self._repo, path, fileid=fileid, filelog=log)
388 getctx = util.cachefunc(getctx)
389 getctx = util.lrucachefunc(getctx)
389 390
390 391 def parents(f):
391 392 # we want to reuse filectx objects as much as possible
@@ -120,8 +120,8 b' def copies(repo, c1, c2, ca, checkdirs=F'
120 120 return c1.filectx(f)
121 121 return c2.filectx(f)
122 122 return repo.filectx(f, fileid=n)
123 ctx = util.cachefunc(makectx)
124 123
124 ctx = util.lrucachefunc(makectx)
125 125 copy = {}
126 126 fullcopy = {}
127 127 diverge = {}
@@ -473,7 +473,9 b' class localrepository(repo.repository):'
473 473 latest = newnodes.pop()
474 474 if latest not in bheads:
475 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 479 bheads = [b for b in bheads if b not in reachable]
478 480 newbheads.insert(0, latest)
479 481 bheads.extend(newbheads)
@@ -35,7 +35,7 b' def _playback(journal, report, opener, e'
35 35 try:
36 36 fn = opener(f).name
37 37 os.unlink(fn)
38 except OSError, inst:
38 except IOError, inst:
39 39 if inst.errno != errno.ENOENT:
40 40 raise
41 41 os.unlink(journal)
@@ -115,6 +115,33 b' def cachefunc(func):'
115 115
116 116 return f
117 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
118 145 class propertycache(object):
119 146 def __init__(self, func):
120 147 self.func = func
@@ -209,11 +209,9 b' def statfiles(files):'
209 209 dircache = {} # dirname -> filename -> status | None if file does not exist
210 210 for nf in files:
211 211 nf = ncase(nf)
212 pos = nf.rfind(sep)
213 if pos == -1:
214 dir, base = '.', nf
215 else:
216 dir, base = nf[:pos+1], nf[pos+1:]
212 dir, base = os.path.split(nf)
213 if not dir:
214 dir = '.'
217 215 cache = dircache.get(dir, None)
218 216 if cache is None:
219 217 try:
@@ -185,6 +185,18 b' echo % fetch should succeed'
185 185 hg --cwd ib2 fetch ../ib1
186 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 200 "$TESTDIR/killdaemons.py"
189 201
190 202 true
@@ -190,3 +190,20 b' 3 files updated, 0 files merged, 0 files'
190 190 pulling from ../ib1
191 191 searching for changes
192 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
General Comments 0
You need to be logged in to leave comments. Login now