# HG changeset patch # User Matt Mackall # Date 1286918763 18000 # Node ID 97fd67f35c008f0e0e0d459b3f35cdcd199a2048 # Parent 372abc799caa5b5360dd93fbba4530001a17d152# Parent 215ba8791f106e1b0a4185be02d104ead26c9bf9 merge with crew diff -r 215ba8791f10 -r 97fd67f35c00 doc/hgrc.5.txt --- a/doc/hgrc.5.txt Tue Oct 12 08:30:15 2010 -0500 +++ b/doc/hgrc.5.txt Tue Oct 12 16:26:03 2010 -0500 @@ -437,6 +437,14 @@ option ensures that the on-disk format of newly created repositories will be compatible with Mercurial before version 1.1. +``dotencode`` + Enable or disable the "dotencode" repository format which enhances + the "fncache" repository format (which has to be enabled to use + dotencode) to avoid issues with filenames starting with ._ on + Mac OS X and spaces on Windows. Enabled by default. Disabling this + option ensures that the on-disk format of newly created + repositories will be compatible with Mercurial before version 1.7. + ``merge-patterns`` """""""""""""""""" diff -r 215ba8791f10 -r 97fd67f35c00 hgext/bookmarks.py --- a/hgext/bookmarks.py Tue Oct 12 08:30:15 2010 -0500 +++ b/hgext/bookmarks.py Tue Oct 12 16:26:03 2010 -0500 @@ -29,8 +29,9 @@ ''' from mercurial.i18n import _ -from mercurial.node import nullid, nullrev, hex, short +from mercurial.node import nullid, nullrev, bin, hex, short from mercurial import util, commands, repair, extensions, pushkey, hg, url +from mercurial import revset import os def write(repo): @@ -536,6 +537,26 @@ setcurrent(repo, rev) return res +def bmrevset(repo, subset, x): + args = revset.getargs(x, 0, 1, _('bookmark takes one or no arguments')) + if args: + bm = revset.getstring(args[0], + _('the argument to bookmark must be a string')) + bmrev = listbookmarks(repo).get(bm, None) + if bmrev: + bmrev = repo.changelog.rev(bin(bmrev)) + return [r for r in subset if r == bmrev] + bms = set([repo.changelog.rev(bin(r)) for r in listbookmarks(repo).values()]) + return [r for r in subset if r in bms] +revset.symbols['bookmark'] = bmrevset + +def revsetdoc(): + doc = help.loaddoc('revsets')() + doc += _('\nAdded by the bookmarks extension:\n\n' + '``bookmark([name])``\n' + ' The named bookmark or all bookmarks.\n') + return doc + cmdtable = { "bookmarks": (bookmark, diff -r 215ba8791f10 -r 97fd67f35c00 hgext/convert/darcs.py --- a/hgext/convert/darcs.py Tue Oct 12 08:30:15 2010 -0500 +++ b/hgext/convert/darcs.py Tue Oct 12 16:26:03 2010 -0500 @@ -7,22 +7,22 @@ from common import NoRepo, checktool, commandline, commit, converter_source from mercurial.i18n import _ -from mercurial import util +from mercurial import encoding, util import os, shutil, tempfile, re # The naming drift of ElementTree is fun! try: - from xml.etree.cElementTree import ElementTree + from xml.etree.cElementTree import ElementTree, XMLParser except ImportError: try: - from xml.etree.ElementTree import ElementTree + from xml.etree.ElementTree import ElementTree, XMLParser except ImportError: try: - from elementtree.cElementTree import ElementTree + from elementtree.cElementTree import ElementTree, XMLParser except ImportError: try: - from elementtree.ElementTree import ElementTree + from elementtree.ElementTree import ElementTree, XMLParser except ImportError: ElementTree = None @@ -88,12 +88,24 @@ self.ui.debug('cleaning up %s\n' % self.tmppath) shutil.rmtree(self.tmppath, ignore_errors=True) + def recode(self, s, encoding=None): + if isinstance(s, unicode): + # XMLParser returns unicode objects for anything it can't + # encode into ASCII. We convert them back to str to get + # recode's normal conversion behavior. + s = s.encode('latin-1') + return super(darcs_source, self).recode(s, encoding) + def xml(self, cmd, **kwargs): # NOTE: darcs is currently encoding agnostic and will print # patch metadata byte-for-byte, even in the XML changelog. etree = ElementTree() + # While we are decoding the XML as latin-1 to be as liberal as + # possible, etree will still raise an exception if any + # non-printable characters are in the XML changelog. + parser = XMLParser(encoding='latin-1') fp = self._run(cmd, **kwargs) - etree.parse(fp) + etree.parse(fp, parser=parser) self.checkexit(fp.close()) return etree.getroot() diff -r 215ba8791f10 -r 97fd67f35c00 hgext/fetch.py --- a/hgext/fetch.py Tue Oct 12 08:30:15 2010 -0500 +++ b/hgext/fetch.py Tue Oct 12 16:26:03 2010 -0500 @@ -29,6 +29,8 @@ order, use --switch-parent. See :hg:`help dates` for a list of formats valid for -d/--date. + + Returns 0 on success. ''' date = opts.get('date') @@ -86,7 +88,7 @@ if newchildren[0] != parent: return hg.clean(repo, newchildren[0]) else: - return + return 0 # Are there more than one additional branch heads? newchildren = [n for n in newchildren if n != parent] @@ -99,7 +101,7 @@ ui.status(_('not merging with %d other new branch heads ' '(use "hg heads ." and "hg merge" to merge them)\n') % (len(newheads) - 1)) - return + return 1 # Otherwise, let's merge. err = False @@ -132,6 +134,8 @@ 'with local\n') % (repo.changelog.rev(n), short(n))) + return err + finally: release(lock, wlock) diff -r 215ba8791f10 -r 97fd67f35c00 hgext/keyword.py --- a/hgext/keyword.py Tue Oct 12 08:30:15 2010 -0500 +++ b/hgext/keyword.py Tue Oct 12 16:26:03 2010 -0500 @@ -82,7 +82,7 @@ {desc}" expands to the first line of the changeset description. ''' -from mercurial import commands, cmdutil, dispatch, filelog, extensions +from mercurial import commands, context, cmdutil, dispatch, filelog, extensions from mercurial import localrepo, match, patch, templatefilters, templater, util from mercurial.hgweb import webcommands from mercurial.i18n import _ @@ -586,6 +586,12 @@ repo.__class__ = kwrepo + def kwfilectx_cmp(orig, self, fctx): + # keyword affects data size, comparing wdir and filelog size does + # not make sense + return self._filelog.cmp(self._filenode, fctx.data()) + extensions.wrapfunction(context.filectx, 'cmp', kwfilectx_cmp) + extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init) extensions.wrapfunction(patch, 'diff', kw_diff) extensions.wrapfunction(cmdutil, 'copy', kw_copy) diff -r 215ba8791f10 -r 97fd67f35c00 mercurial/context.py --- a/mercurial/context.py Tue Oct 12 08:30:15 2010 -0500 +++ b/mercurial/context.py Tue Oct 12 16:26:03 2010 -0500 @@ -357,6 +357,9 @@ returns True if different than fctx. """ + if not self._repo._encodefilterpats and self.size() != fctx.size(): + return True + return self._filelog.cmp(self._filenode, fctx.data()) def renamed(self): diff -r 215ba8791f10 -r 97fd67f35c00 mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt Tue Oct 12 08:30:15 2010 -0500 +++ b/mercurial/help/revsets.txt Tue Oct 12 16:26:03 2010 -0500 @@ -94,6 +94,9 @@ ``heads(set)`` Members of set with no children in set. +``id(string)`` + Revision non-ambiguously specified by the given hex string prefix + ``keyword(string)`` Search commit message, user name, and names of changed files for string. @@ -133,6 +136,9 @@ ``removes(pattern)`` Changesets which remove files matching pattern. +``rev(number)`` + Revision with the given numeric identifier. + ``reverse(set)`` Reverse order of set. @@ -151,8 +157,8 @@ - ``user`` for user name (``author`` can be used as an alias), - ``date`` for the commit date -``tagged()`` - Changeset is tagged. +``tag(name)`` + The specified tag by name, or all tagged revisions if no name is given. ``user(string)`` User name is string. diff -r 215ba8791f10 -r 97fd67f35c00 mercurial/localrepo.py --- a/mercurial/localrepo.py Tue Oct 12 08:30:15 2010 -0500 +++ b/mercurial/localrepo.py Tue Oct 12 16:26:03 2010 -0500 @@ -586,11 +586,10 @@ fn = lambda s, c, **kwargs: oldfn(s, c) l.append((mf, fn, params)) self.filterpats[filter] = l + return self.filterpats[filter] - def _filter(self, filter, filename, data): - self._loadfilter(filter) - - for mf, fn, cmd in self.filterpats[filter]: + def _filter(self, filterpats, filename, data): + for mf, fn, cmd in filterpats: if mf(filename): self.ui.debug("filtering %s through %s\n" % (filename, cmd)) data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) @@ -598,6 +597,14 @@ return data + @propertycache + def _encodefilterpats(self): + return self._loadfilter('encode') + + @propertycache + def _decodefilterpats(self): + return self._loadfilter('decode') + def adddatafilter(self, name, filter): self._datafilters[name] = filter @@ -606,10 +613,10 @@ data = os.readlink(self.wjoin(filename)) else: data = self.wopener(filename, 'r').read() - return self._filter("encode", filename, data) + return self._filter(self._encodefilterpats, filename, data) def wwrite(self, filename, data, flags): - data = self._filter("decode", filename, data) + data = self._filter(self._decodefilterpats, filename, data) try: os.unlink(self.wjoin(filename)) except OSError: @@ -622,7 +629,7 @@ util.set_flags(self.wjoin(filename), False, True) def wwritedata(self, filename, data): - return self._filter("decode", filename, data) + return self._filter(self._decodefilterpats, filename, data) def transaction(self, desc): tr = self._transref and self._transref() or None diff -r 215ba8791f10 -r 97fd67f35c00 mercurial/revset.py --- a/mercurial/revset.py Tue Oct 12 08:30:15 2010 -0500 +++ b/mercurial/revset.py Tue Oct 12 16:26:03 2010 -0500 @@ -173,6 +173,23 @@ # functions +def node(repo, subset, x): + l = getargs(x, 1, 1, _("rev wants one argument")) + n = getstring(l[0], _("rev wants a string")) + if len(n) == 40: + rn = repo[n].rev() + else: + rn = repo.changelog.rev(repo.changelog._partialmatch(n)) + return [r for r in subset if r == rn] + +def rev(repo, subset, x): + l = getargs(x, 1, 1, _("rev wants one argument")) + try: + l = int(getstring(l[0], _("rev wants a number"))) + except ValueError: + raise error.ParseError(_("rev expects a number")) + return [r for r in subset if r == l] + def p1(repo, subset, x): ps = set() cl = repo.changelog @@ -467,10 +484,15 @@ o = set([cl.rev(r) for r in repo.changelog.nodesbetween(o, revs)[0]]) return [r for r in subset if r in o] -def tagged(repo, subset, x): - getargs(x, 0, 0, _("tagged takes no arguments")) +def tag(repo, subset, x): + args = getargs(x, 0, 1, _("tag takes one or no arguments")) cl = repo.changelog - s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) + if args: + tn = getstring(args[0], + _('the argument to tag must be a string')) + s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) + else: + s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) return [r for r in subset if r in s] symbols = { @@ -496,6 +518,7 @@ "min": minrev, "merge": merge, "modifies": modifies, + "id": node, "outgoing": outgoing, "p1": p1, "p2": p2, @@ -503,9 +526,11 @@ "present": present, "removes": removes, "reverse": reverse, + "rev": rev, "roots": roots, "sort": sort, - "tagged": tagged, + "tag": tag, + "tagged": tag, "user": author, } diff -r 215ba8791f10 -r 97fd67f35c00 mercurial/templates/paper/help.tmpl --- a/mercurial/templates/paper/help.tmpl Tue Oct 12 08:30:15 2010 -0500 +++ b/mercurial/templates/paper/help.tmpl Tue Oct 12 16:26:03 2010 -0500 @@ -18,7 +18,6 @@
  • graph
  • tags
  • branches
  • -
  • help