changeset 11711:a2d45964f60c

merge crew and main
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sat, 31 Jul 2010 11:05:11 +0900
parents efcdf6a953a0 (current diff) ba65d61f3158 (diff)
children 57a8894e3f75
files
diffstat 14 files changed, 95 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/hgext/bookmarks.py	Sat Jul 31 11:05:11 2010 +0900
@@ -136,6 +136,9 @@
         if "\n" in mark:
             raise util.Abort(_("bookmark name cannot contain newlines"))
         mark = mark.strip()
+        if not mark:
+            raise util.Abort(_("bookmark names cannot consist entirely of "
+                               "whitespace"))
         if mark in marks and not force:
             raise util.Abort(_("a bookmark of the same name already exists"))
         if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
--- a/hgext/mq.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/hgext/mq.py	Sat Jul 31 11:05:11 2010 +0900
@@ -1687,11 +1687,22 @@
             if existing:
                 if filename == '-':
                     raise util.Abort(_('-e is incompatible with import from -'))
-                if not patchname:
-                    patchname = normname(filename)
-                self.check_reserved_name(patchname)
-                if not os.path.isfile(self.join(patchname)):
-                    raise util.Abort(_("patch %s does not exist") % patchname)
+                filename = normname(filename)
+                self.check_reserved_name(filename)
+                originpath = self.join(filename)
+                if not os.path.isfile(originpath):
+                    raise util.Abort(_("patch %s does not exist") % filename)
+
+                if patchname:
+                    self.check_reserved_name(patchname)
+                    checkfile(patchname)
+
+                    self.ui.write(_('renaming %s to %s\n')
+                                        % (filename, patchname))
+                    util.rename(originpath, self.join(patchname))
+                else:
+                    patchname = filename
+
             else:
                 try:
                     if filename == '-':
@@ -1806,6 +1817,10 @@
     To import a patch from standard input, pass - as the patch file.
     When importing from standard input, a patch name must be specified
     using the --name flag.
+
+    To import an existing patch while renaming it::
+
+      hg qimport -e existing-patch -n new-name
     """
     q = repo.mq
     try:
--- a/mercurial/context.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/context.py	Sat Jul 31 11:05:11 2010 +0900
@@ -352,12 +352,12 @@
     def size(self):
         return self._filelog.size(self._filerev)
 
-    def cmp(self, text):
-        """compare text with stored file revision
+    def cmp(self, fctx):
+        """compare with other file context
 
-        returns True if text is different than what is stored.
+        returns True if different than fctx.
         """
-        return self._filelog.cmp(self._filenode, text)
+        return self._filelog.cmp(self._filenode, fctx.data())
 
     def renamed(self):
         """check if file was actually renamed in this changeset revision
@@ -935,12 +935,14 @@
                 raise
             return (t, tz)
 
-    def cmp(self, text):
-        """compare text with disk content
+    def cmp(self, fctx):
+        """compare with other file context
 
-        returns True if text is different than what is on disk.
+        returns True if different than fctx.
         """
-        return self._repo.wread(self._path) != text
+        # fctx should be a filectx (not a wfctx)
+        # invert comparison to reuse the same code path
+        return fctx.cmp(self)
 
 class memctx(object):
     """Use memctx to perform in-memory commits via localrepo.commitctx().
--- a/mercurial/filemerge.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/filemerge.py	Sat Jul 31 11:05:11 2010 +0900
@@ -135,7 +135,7 @@
         except IOError:
             return False
 
-    if not fco.cmp(fcd.data()): # files identical?
+    if not fco.cmp(fcd): # files identical?
         return None
 
     if fca == fco: # backwards, use working dir parent as ancestor
--- a/mercurial/help/revsets.txt	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/help/revsets.txt	Sat Jul 31 11:05:11 2010 +0900
@@ -100,6 +100,9 @@
 ``max(set)``
   Changeset with highest revision number in set.
 
+``min(set)``
+  Changeset with lowest revision number in set.
+
 ``merge()``
   Changeset is a merge changeset.
 
--- a/mercurial/localrepo.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/localrepo.py	Sat Jul 31 11:05:11 2010 +0900
@@ -510,7 +510,7 @@
     def _link(self, f):
         return os.path.islink(self.wjoin(f))
 
-    def _filter(self, filter, filename, data):
+    def _loadfilter(self, filter):
         if filter not in self.filterpats:
             l = []
             for pat, cmd in self.ui.configitems(filter):
@@ -533,6 +533,9 @@
                 l.append((mf, fn, params))
             self.filterpats[filter] = l
 
+    def _filter(self, filter, filename, data):
+        self._loadfilter(filter)
+
         for mf, fn, cmd in self.filterpats[filter]:
             if mf(filename):
                 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
@@ -1059,7 +1062,7 @@
                 # do a full compare of any files that might have changed
                 for f in sorted(cmp):
                     if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
-                        or ctx1[f].cmp(ctx2[f].data())):
+                        or ctx1[f].cmp(ctx2[f])):
                         modified.append(f)
                     else:
                         fixup.append(f)
@@ -1103,7 +1106,7 @@
                 if fn in mf1:
                     if (mf1.flags(fn) != mf2.flags(fn) or
                         (mf1[fn] != mf2[fn] and
-                         (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))):
+                         (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))):
                         modified.append(fn)
                     elif listclean:
                         clean.append(fn)
--- a/mercurial/merge.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/merge.py	Sat Jul 31 11:05:11 2010 +0900
@@ -73,7 +73,7 @@
 def _checkunknown(wctx, mctx):
     "check for collisions between unknown files and files in mctx"
     for f in wctx.unknown():
-        if f in mctx and mctx[f].cmp(wctx[f].data()):
+        if f in mctx and mctx[f].cmp(wctx[f]):
             raise util.Abort(_("untracked file in working directory differs"
                                " from file in requested revision: '%s'") % f)
 
--- a/mercurial/revset.py	Tue Jul 27 16:04:00 2010 -0500
+++ b/mercurial/revset.py	Sat Jul 31 11:05:11 2010 +0900
@@ -195,6 +195,14 @@
             return [m]
     return []
 
+def minrev(repo, subset, x):
+    s = getset(repo, subset, x)
+    if s:
+        m = min(s)
+        if m in subset:
+            return [m]
+    return []
+
 def limit(repo, subset, x):
     l = getargs(x, 2, 2, _("limit wants two arguments"))
     try:
@@ -466,6 +474,7 @@
     "keyword": keyword,
     "limit": limit,
     "max": maxrev,
+    "min": minrev,
     "merge": merge,
     "modifies": modifies,
     "outgoing": outgoing,
--- a/tests/test-bookmarks	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-bookmarks	Sat Jul 31 11:05:11 2010 +0900
@@ -100,4 +100,7 @@
 echo % revision but no bookmark name
 hg bookmark -r .
 
+echo % bookmark name with whitespace only
+hg bookmark ' '
+
 true
--- a/tests/test-bookmarks.out	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-bookmarks.out	Sat Jul 31 11:05:11 2010 +0900
@@ -74,3 +74,5 @@
  * x  y                      2:0316ce92851d
 % revision but no bookmark name
 abort: bookmark name required
+% bookmark name with whitespace only
+abort: bookmark names cannot consist entirely of whitespace
--- a/tests/test-mq-qimport	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-mq-qimport	Sat Jul 31 11:05:11 2010 +0900
@@ -109,3 +109,19 @@
 hg qimport --push another.diff
 hg qfin -a
 hg qimport -rtip -P
+
+hg qpop -a
+hg qdel -k 2.diff
+echo % qimport -e
+hg qimport -e 2.diff
+hg qdel -k 2.diff
+echo % qimport -e --name newname oldexisitingpatch
+hg qimport -e --name this-name-is-better 2.diff
+hg qser
+echo % qimport -e --name without --force
+cp .hg/patches/this-name-is-better .hg/patches/3.diff
+hg qimport -e --name this-name-is-better 3.diff
+hg qser
+echo % qimport -e --name with --force
+hg qimport --force -e --name this-name-is-better 3.diff
+hg qser
--- a/tests/test-mq-qimport.out	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-mq-qimport.out	Sat Jul 31 11:05:11 2010 +0900
@@ -52,3 +52,21 @@
 now at: another.diff
 patch b.diff finalized without changeset message
 patch another.diff finalized without changeset message
+popping 2.diff
+patch queue now empty
+% qimport -e
+adding 2.diff to series file
+% qimport -e --name newname oldexisitingpatch
+renaming 2.diff to this-name-is-better
+adding this-name-is-better to series file
+this-name-is-better
+url.diff
+% qimport -e --name without --force
+abort: patch "this-name-is-better" already exists
+this-name-is-better
+url.diff
+% qimport -e --name with --force
+renaming 3.diff to this-name-is-better
+adding this-name-is-better to series file
+this-name-is-better
+url.diff
--- a/tests/test-revset	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-revset	Sat Jul 31 11:05:11 2010 +0900
@@ -110,6 +110,7 @@
 log 'keyword(issue)'
 log 'limit(head(), 1)'
 log 'max(contains(a))'
+log 'min(contains(a))'
 log 'merge()'
 log 'modifies(b)'
 log 'p1(merge())'
--- a/tests/test-revset.out	Tue Jul 27 16:04:00 2010 -0500
+++ b/tests/test-revset.out	Sat Jul 31 11:05:11 2010 +0900
@@ -152,6 +152,8 @@
 0
 % log 'max(contains(a))'
 5
+% log 'min(contains(a))'
+0
 % log 'merge()'
 6
 % log 'modifies(b)'