##// END OF EJS Templates
largefiles: optimize update speed by only updating changed largefiles...
largefiles: optimize update speed by only updating changed largefiles Historically, during 'hg update', every largefile in the working copy was hashed (which is a very expensive operation on big files) and any largefiles that did not have a hash that matched their standin were updated. This patch optimizes 'hg update' by keeping track of what standins have changed between the old and new revisions, and only updating the largefiles that have changed. This saves a lot of time by avoiding the unecessary calculation of a list of sha1 hashes for big files. With this patch, the time 'hg update' takes to complete is a function of how many largefiles need to be updated and what their size is. Performance tests on a repository with about 80 largefiles ranging from a few MB to about 97 MB are shown below. The tests show how long it takes to run 'hg update' with no changes actually being updated. Mercurial 2.1 release: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 0 removed real 0m10.045s user 0m9.367s sys 0m0.674s With this patch: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved real 0m0.965s user 0m0.845s sys 0m0.115s The same repsoitory, without the largefiles extension enabled: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved real 0m0.799s user 0m0.684s sys 0m0.111s So before the patch, 'hg update' with no changes was approximately 9.25s slower with largefiles enabled. With this patch, it is approximately 0.165s slower.

File last commit:

r12766:21a50fe4 default
r16120:47ee41fc default
Show More
interhg.py
81 lines | 2.7 KiB | text/x-python | PythonLexer
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817 # interhg.py - interhg
#
# Copyright 2007 OHASHI Hideya <ohachige@gmail.com>
#
Edward Lee
interhg: allow more flexible pattern specification (fixes 2/3 of issue699)...
r5288 # Contributor(s):
# Edward Lee <edward.lee@engineering.uiuc.edu>
#
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
Cédric Duval
interhg: upgrade comments to online help and improve them...
r8824
'''expand expressions into changelog and summaries
Martin Geisler
interhg: wrap docstrings at 70 characters
r9263 This extension allows the use of a special syntax in summaries, which
will be automatically expanded into links or any other arbitrary
expression, much like InterWiki does.
Cédric Duval
interhg: upgrade comments to online help and improve them...
r8824
Martin Geisler
interhg: wrap docstrings at 70 characters
r9263 A few example patterns (link to bug tracking, etc.) that may be used
in your hgrc::
Cédric Duval
interhg: upgrade comments to online help and improve them...
r8824
[interhg]
Martin Geisler
interhg: escape backslashes in docstring
r8910 issues = s!issue(\\d+)!<a href="http://bts/issue\\1">issue\\1</a>!
bugzilla = s!((?:bug|b=|(?=#?\\d{4,}))(?:\\s*#?)(\\d+))!<a..=\\2">\\1</a>!i
boldify = s!(^|\\s)#(\\d+)\\b! <b>#\\2</b>!
Cédric Duval
interhg: upgrade comments to online help and improve them...
r8824 '''
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817
import re
from mercurial.hgweb import hgweb_mod
Matt Mackall
extensions: use new wrapper functions
r7216 from mercurial import templatefilters, extensions
Martin Geisler
i18n: mark strings for translation in interhg extension
r6962 from mercurial.i18n import _
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817
interhg_table = []
Augie Fackler
interhg: use uisetup() instead of module-load side effects...
r12766 def uisetup(ui):
orig_escape = templatefilters.filters["escape"]
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817
Augie Fackler
interhg: use uisetup() instead of module-load side effects...
r12766 def interhg_escape(x):
escstr = orig_escape(x)
for regexp, format in interhg_table:
escstr = regexp.sub(format, escstr)
return escstr
templatefilters.filters["escape"] = interhg_escape
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817
Wagner Bruna
interhg: fixes regression introduced by 38170eeed18c
r10472 def interhg_refresh(orig, self, *args, **kwargs):
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817 interhg_table[:] = []
Edward Lee
interhg: allow more flexible pattern specification (fixes 2/3 of issue699)...
r5288 for key, pattern in self.repo.ui.configitems('interhg'):
# grab the delimiter from the character after the "s"
unesc = pattern[1]
delim = re.escape(unesc)
# identify portions of the pattern, taking care to avoid escaped
# delimiters. the replace format and flags are optional, but delimiters
# are required.
match = re.match(r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$'
% (delim, delim, delim), pattern)
if not match:
Martin Geisler
i18n: mark strings for translation in interhg extension
r6962 self.repo.ui.warn(_("interhg: invalid pattern for %s: %s\n")
Edward Lee
interhg: allow more flexible pattern specification (fixes 2/3 of issue699)...
r5288 % (key, pattern))
continue
# we need to unescape the delimiter for regexp and format
delim_re = re.compile(r'(?<!\\)\\%s' % delim)
regexp = delim_re.sub(unesc, match.group(1))
format = delim_re.sub(unesc, match.group(2))
# the pattern allows for 6 regexp flags, so set them if necessary
flagin = match.group(3)
flags = 0
if flagin:
for flag in flagin.upper():
flags |= re.__dict__[flag]
try:
regexp = re.compile(regexp, flags)
interhg_table.append((regexp, format))
except re.error:
Martin Geisler
i18n: mark strings for translation in interhg extension
r6962 self.repo.ui.warn(_("interhg: invalid regexp for %s: %s\n")
Edward Lee
interhg: allow more flexible pattern specification (fixes 2/3 of issue699)...
r5288 % (key, regexp))
Wagner Bruna
interhg: fixes regression introduced by 38170eeed18c
r10472 return orig(self, *args, **kwargs)
OHASHI Hideya
interhg extension allows you to change changelog text like InterWiki.
r4817
Matt Mackall
extensions: use new wrapper functions
r7216 extensions.wrapfunction(hgweb_mod.hgweb, 'refresh', interhg_refresh)