merge with crew
authorMatt Mackall <mpm@selenic.com>
Tue, 12 Oct 2010 16:26:03 -0500
changeset 12720 97fd67f35c00
parent 12718 372abc799caa (diff)
parent 12719 215ba8791f10 (current diff)
child 12721 d4e21a9de8bc
merge with crew
contrib/compress.py
--- 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``
 """"""""""""""""""
 
--- 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,
--- 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()
 
--- 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)
 
--- 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)
--- 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):
--- 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.
--- 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
--- 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,
 }
 
--- 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 @@
 <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
 <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
 <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
-<li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
 </ul>
 <ul>
  <li class="active">help</li>
--- a/mercurial/templates/paper/helptopics.tmpl	Tue Oct 12 08:30:15 2010 -0500
+++ b/mercurial/templates/paper/helptopics.tmpl	Tue Oct 12 16:26:03 2010 -0500
@@ -18,7 +18,6 @@
 <li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
 <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
 <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
-<li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
 </ul>
 <ul>
 <li class="active">help</li>
--- a/tests/test-bookmarks.t	Tue Oct 12 08:30:15 2010 -0500
+++ b/tests/test-bookmarks.t	Tue Oct 12 16:26:03 2010 -0500
@@ -62,6 +62,28 @@
   $ hg add b
   $ hg commit -m 1
 
+bookmarks revset
+
+  $ hg log -r 'bookmark()'
+  changeset:   1:925d80f479bb
+  tag:         X
+  tag:         X2
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+  $ hg log -r 'bookmark(Y)'
+  $ hg log -r 'bookmark(X2)'
+  changeset:   1:925d80f479bb
+  tag:         X
+  tag:         X2
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+
 bookmarks X and X2 moved to rev 1, Y at rev -1
 
   $ hg bookmarks
--- a/tests/test-convert-darcs.t	Tue Oct 12 08:30:15 2010 -0500
+++ b/tests/test-convert-darcs.t	Tue Oct 12 16:26:03 2010 -0500
@@ -49,8 +49,6 @@
   $ darcs record -a -l -m p1.2
   Finished recording patch 'p1.2'
 
-merge branch
-
   $ darcs pull -a ../darcs-clone
   Backing up ./a(-darcs-backup0)
   We have conflicts in the following files:
@@ -85,6 +83,15 @@
 
   $ darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
   Finished recording patch 'p4: desc ñ'
+
+Test latin-1 commit message
+
+  $ echo h > h
+  $ printf "p5: desc " > ../p5
+  $ python -c 'print "".join([chr(i) for i in range(128, 256)])' >> ../p5
+  $ darcs record -a -l --logfile ../p5
+  Finished recording patch 'p5: desc '
+ 
   $ glog()
   > {
   >     HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
@@ -95,12 +102,13 @@
   scanning source...
   sorting...
   converting...
-  5 p0
-  4 p1.2
-  3 p1.1
-  2 p2
-  1 p3
-  0 p4: desc ?
+  6 p0
+  5 p1.2
+  4 p1.1
+  3 p2
+  2 p3
+  1 p4: desc ?
+  0 p5: desc ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
 
 The converter does not currently handle patch conflicts very well.
 When they occur, it reverts *all* changes and moves forward,
@@ -109,8 +117,11 @@
 "c" file in p1.1 patch are reverted too.
 Just to say that manifest not listing "c" here is a bug.
 
-  $ glog -R darcs-repo-hg
-  o  5 "p4: desc ñ" (author ñ) files: g
+  $ HGENCODING=latin-1 glog -R darcs-repo-hg -r 6 | "$TESTDIR"/printrepr.py
+  o  6 "p5: desc \xc2\x80\xc2\x81\xc2\x82\xc2\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99\xc2\x9a\xc2\x9b\xc2\x9c\xc2\x9d\xc2\x9e\xc2\x9f\xc2\xa0\xc2\xa1\xc2\xa2\xc2\xa3\xc2\xa4\xc2\xa5\xc2\xa6\xc2\xa7\xc2\xa8\xc2\xa9\xc2\xaa\xc2\xab\xc2\xac\xc2\xad\xc2\xae\xc2\xaf\xc2\xb0\xc2\xb1\xc2\xb2\xc2\xb3\xc2\xb4\xc2\xb5\xc2\xb6\xc2\xb7\xc2\xb8\xc2\xb9\xc2\xba\xc2\xbb\xc2\xbc\xc2\xbd\xc2\xbe\xc2\xbf\xc3\x80\xc3\x81\xc3\x82\xc3\x83\xc3\x84\xc3\x85\xc3\x86\xc3\x87\xc3\x88\xc3\x89\xc3\x8a\xc3\x8b\xc3\x8c\xc3\x8d\xc3\x8e\xc3\x8f\xc3\x90\xc3\x91\xc3\x92\xc3\x93\xc3\x94\xc3\x95\xc3\x96\xc3\x97\xc3\x98\xc3\x99\xc3\x9a\xc3\x9b\xc3\x9c\xc3\x9d\xc3\x9e\xc3\x9f\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4\xc3\xa5\xc3\xa6\xc3\xa7\xc3\xa8\xc3\xa9\xc3\xaa\xc3\xab\xc3\xac\xc3\xad\xc3\xae\xc3\xaf\xc3\xb0\xc3\xb1\xc3\xb2\xc3\xb3\xc3\xb4\xc3\xb5\xc3\xb6\xc3\xb7\xc3\xb8\xc3\xb9\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3\xbe\xc3\xbf" (test@example.org) files: h
+  |
+  $ HGENCODING=utf-8 glog -R darcs-repo-hg -r 0:5 | "$TESTDIR"/printrepr.py
+  o  5 "p4: desc \xc3\xb1" (author \xc3\xb1) files: g
   |
   o  4 "p3" (test@example.org) files: dir/d dir/d2 dir2/d f ff
   |
@@ -122,6 +133,7 @@
   |
   o  0 "p0" (test@example.org) files: a
   
+
   $ hg up -q -R darcs-repo-hg
   $ hg -R darcs-repo-hg manifest --debug
   7225b30cdf38257d5cc7780772c051b6f33e6d6b 644   a
@@ -129,3 +141,4 @@
   37406831adc447ec2385014019599dfec953c806 644   dir2/d
   b783a337463792a5c7d548ad85a7d3253c16ba8c 644   ff
   0973eb1b2ecc4de7fafe7447ce1b7462108b4848 644   g
+  fe6f8b4f507fe3eb524c527192a84920a4288dac 644   h
--- a/tests/test-fetch.t	Tue Oct 12 08:30:15 2010 -0500
+++ b/tests/test-fetch.t	Tue Oct 12 16:26:03 2010 -0500
@@ -305,6 +305,7 @@
   adding file changes
   added 3 changesets with 2 changes to 1 files (+2 heads)
   not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
+  [1]
 
 parent should be 3 (fetch did not merge anything)
 
--- a/tests/test-init.t	Tue Oct 12 08:30:15 2010 -0500
+++ b/tests/test-init.t	Tue Oct 12 16:26:03 2010 -0500
@@ -62,6 +62,16 @@
   revlogv1
   store
 
+creating repo with format.dotencode=false
+
+  $ hg --config format.dotencode=false init old3
+  $ checknewrepo old3
+  store created
+  00changelog.i created
+  revlogv1
+  store
+  fncache
+
 test failure
 
   $ hg init local
--- a/tests/test-revset.t	Tue Oct 12 08:30:15 2010 -0500
+++ b/tests/test-revset.t	Tue Oct 12 16:26:03 2010 -0500
@@ -247,6 +247,8 @@
   6
   $ log 'modifies(b)'
   4
+  $ log 'id(5)'
+  2
   $ log 'outgoing()'
   8
   9
@@ -276,6 +278,8 @@
   4
   3
   2
+  $ log 'rev(5)'
+  5
   $ log 'sort(limit(reverse(all()), 3))'
   7
   8
@@ -287,6 +291,12 @@
   4
   $ log 'tagged()'
   6
+  $ log 'tag()'
+  6
+  $ log 'tag(1.0)'
+  6
+  $ log 'tag(tip)'
+  9
   $ log 'user(bob)'
   2