Merge backout
authorSteve Borho <steve@borho.org>
Tue, 08 Jun 2010 15:52:56 -0500
changeset 11311 fcd06ecd4cb7
parent 11309 ef7636efeb01 (diff)
parent 11310 ac873ecfc3c2 (current diff)
child 11312 3f1409082720
child 11313 0bb14798cd07
Merge backout
hgext/mq.py
mercurial/commands.py
mercurial/ui.py
--- a/contrib/mergetools.hgrc	Tue Jun 08 15:52:41 2010 -0500
+++ b/contrib/mergetools.hgrc	Tue Jun 08 15:52:56 2010 -0500
@@ -101,3 +101,12 @@
 diffuse.args=$local $base $other
 diffuse.gui=True
 diffuse.diffargs=$parent $child
+
+UltraCompare.regkey=Software\Microsoft\Windows\CurrentVersion\App Paths\UC.exe
+UltraCompare.args = $base $local $other -title1 base -title3 other
+UltraCompare.priority = -2
+UltraCompare.gui = True
+UltraCompare.binary = True
+UltraCompare.checkconflicts = True
+UltraCompare.checkchanged = True
+UltraCompare.diffargs=$child $parent -title1 $clabel -title2 $plabel1
--- a/hgext/gpg.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/hgext/gpg.py	Tue Jun 08 15:52:56 2010 -0500
@@ -247,7 +247,7 @@
     repo.wfile(".hgsigs", "ab").write(sigmessage)
 
     if '.hgsigs' not in repo.dirstate:
-        repo.add([".hgsigs"])
+        repo[None].add([".hgsigs"])
 
     if opts["no_commit"]:
         return
--- a/hgext/keyword.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/hgext/keyword.py	Tue Jun 08 15:52:56 2010 -0500
@@ -358,7 +358,7 @@
     demoitems('keywordmaps', kwmaps.iteritems())
     keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
     repo.wopener(fn, 'w').write(keywords)
-    repo.add([fn])
+    repo[None].add([fn])
     ui.note(_('\nkeywords written to %s:\n') % fn)
     ui.note(keywords)
     repo.dirstate.setbranch('demobranch')
--- a/hgext/mq.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/hgext/mq.py	Tue Jun 08 15:52:56 2010 -0500
@@ -705,7 +705,7 @@
         if not keep:
             r = self.qrepo()
             if r:
-                r.remove(patches, True)
+                r[None].remove(patches, True)
             else:
                 for p in patches:
                     os.unlink(self.join(p))
@@ -874,7 +874,7 @@
                     wlock = None
                     r = self.qrepo()
                     if r:
-                        r.add([patchfn])
+                        r[None].add([patchfn])
                 except:
                     repo.rollback()
                     raise
@@ -1713,7 +1713,7 @@
         self.series_dirty = 1
         qrepo = self.qrepo()
         if qrepo:
-            qrepo.add(added)
+            qrepo[None].add(added)
 
 def delete(ui, repo, *patches, **opts):
     """remove patches from queue
@@ -1722,7 +1722,7 @@
     -k/--keep, the patch files are preserved in the patch directory.
 
     To stop managing a patch and move it into permanent history,
-    use the qfinish command."""
+    use the :hg:`qfinish` command."""
     q = repo.mq
     q.delete(repo, patches, opts)
     q.save_dirty()
@@ -1832,7 +1832,7 @@
             fp.close()
         if not os.path.exists(r.wjoin('series')):
             r.wopener('series', 'w').close()
-        r.add(['.hgignore', 'series'])
+        r[None].add(['.hgignore', 'series'])
         commands.add(ui, r)
     return 0
 
@@ -2131,8 +2131,8 @@
 
     Guards control whether a patch can be pushed. A patch with no
     guards is always pushed. A patch with a positive guard ("+foo") is
-    pushed only if the qselect command has activated it. A patch with
-    a negative guard ("-foo") is never pushed if the qselect command
+    pushed only if the :hg:`qselect` command has activated it. A patch with
+    a negative guard ("-foo") is never pushed if the :hg:`qselect` command
     has activated it.
 
     With no arguments, print the currently active guards.
@@ -2308,6 +2308,7 @@
     util.rename(q.join(patch), absdest)
     r = q.qrepo()
     if r:
+        wctx = r[None]
         wlock = r.wlock()
         try:
             if r.dirstate[patch] == 'a':
@@ -2315,9 +2316,9 @@
                 r.dirstate.add(name)
             else:
                 if r.dirstate[name] == 'r':
-                    r.undelete([name])
-                r.copy(patch, name)
-                r.remove([patch], False)
+                    wctx.undelete([name])
+                wctx.copy(patch, name)
+                wctx.remove([patch], False)
         finally:
             wlock.release()
 
@@ -2413,7 +2414,7 @@
 def select(ui, repo, *args, **opts):
     '''set or print guarded patches to push
 
-    Use the qguard command to set or print guards on patch, then use
+    Use the :hg:`qguard` command to set or print guards on patch, then use
     qselect to tell mq which guards to use. A patch will be pushed if
     it has no guards or any positive guards match the currently
     selected guard, but will not be pushed if any negative guards
--- a/mercurial/cmdutil.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/cmdutil.py	Tue Jun 08 15:52:56 2010 -0500
@@ -311,12 +311,13 @@
             copies[new] = old
 
     if not dry_run:
+        wctx = repo[None]
         wlock = repo.wlock()
         try:
-            repo.remove(deleted)
-            repo.add(unknown)
+            wctx.remove(deleted)
+            wctx.add(unknown)
             for new, old in copies.iteritems():
-                repo.copy(old, new)
+                wctx.copy(old, new)
         finally:
             wlock.release()
 
@@ -329,6 +330,7 @@
     targets = {}
     after = opts.get("after")
     dryrun = opts.get("dry_run")
+    wctx = repo[None]
 
     def walkpat(pat):
         srcs = []
@@ -421,12 +423,12 @@
                               "data will be stored for %s.\n")
                             % (repo.pathto(origsrc, cwd), reltarget))
                 if repo.dirstate[abstarget] in '?r' and not dryrun:
-                    repo.add([abstarget])
+                    wctx.add([abstarget])
             elif not dryrun:
-                repo.copy(origsrc, abstarget)
+                wctx.copy(origsrc, abstarget)
 
         if rename and not dryrun:
-            repo.remove([abssrc], not after)
+            wctx.remove([abssrc], not after)
 
     # pat: ossep
     # dest ossep
--- a/mercurial/commands.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/commands.py	Tue Jun 08 15:52:56 2010 -0500
@@ -56,7 +56,7 @@
             if ui.verbose or not exact:
                 ui.status(_('adding %s\n') % m.rel(f))
     if not opts.get('dry_run'):
-        bad += [f for f in repo.add(names) if f in m.files()]
+        bad += [f for f in repo[None].add(names) if f in m.files()]
     return bad and 1 or 0
 
 def addremove(ui, repo, *pats, **opts):
@@ -1314,7 +1314,7 @@
         if ui.verbose or not m.exact(f):
             ui.status(_('removing %s\n') % m.rel(f))
 
-    repo.remove(forget, unlink=False)
+    repo[None].remove(forget, unlink=False)
     return errs
 
 def grep(ui, repo, pattern, *pats, **opts):
@@ -2669,8 +2669,8 @@
         if ui.verbose or not m.exact(f):
             ui.status(_('removing %s\n') % m.rel(f))
 
-    repo.forget(forget)
-    repo.remove(remove, unlink=not after)
+    repo[None].forget(forget)
+    repo[None].remove(remove, unlink=not after)
     return ret
 
 def rename(ui, repo, *pats, **opts):
--- a/mercurial/context.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/context.py	Tue Jun 08 15:52:56 2010 -0500
@@ -8,7 +8,7 @@
 from node import nullid, nullrev, short, hex
 from i18n import _
 import ancestor, bdiff, error, util, subrepo, patch
-import os, errno
+import os, errno, stat
 
 propertycache = util.propertycache
 
@@ -761,6 +761,103 @@
                 self.modified() or self.added() or self.removed() or
                 (missing and self.deleted()))
 
+    def add(self, list):
+        wlock = self._repo.wlock()
+        ui, ds = self._repo.ui, self._repo.dirstate
+        try:
+            rejected = []
+            for f in list:
+                p = self._repo.wjoin(f)
+                try:
+                    st = os.lstat(p)
+                except:
+                    ui.warn(_("%s does not exist!\n") % f)
+                    rejected.append(f)
+                    continue
+                if st.st_size > 10000000:
+                    ui.warn(_("%s: up to %d MB of RAM may be required "
+                              "to manage this file\n"
+                              "(use 'hg revert %s' to cancel the "
+                              "pending addition)\n")
+                              % (f, 3 * st.st_size // 1000000, f))
+                if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
+                    ui.warn(_("%s not added: only files and symlinks "
+                              "supported currently\n") % f)
+                    rejected.append(p)
+                elif ds[f] in 'amn':
+                    ui.warn(_("%s already tracked!\n") % f)
+                elif ds[f] == 'r':
+                    ds.normallookup(f)
+                else:
+                    ds.add(f)
+            return rejected
+        finally:
+            wlock.release()
+
+    def forget(self, list):
+        wlock = self._repo.wlock()
+        try:
+            for f in list:
+                if self._repo.dirstate[f] != 'a':
+                    self._repo.ui.warn(_("%s not added!\n") % f)
+                else:
+                    self._repo.dirstate.forget(f)
+        finally:
+            wlock.release()
+
+    def remove(self, list, unlink=False):
+        if unlink:
+            for f in list:
+                try:
+                    util.unlink(self._repo.wjoin(f))
+                except OSError, inst:
+                    if inst.errno != errno.ENOENT:
+                        raise
+        wlock = self._repo.wlock()
+        try:
+            for f in list:
+                if unlink and os.path.exists(self._repo.wjoin(f)):
+                    self._repo.ui.warn(_("%s still exists!\n") % f)
+                elif self._repo.dirstate[f] == 'a':
+                    self._repo.dirstate.forget(f)
+                elif f not in self._repo.dirstate:
+                    self._repo.ui.warn(_("%s not tracked!\n") % f)
+                else:
+                    self._repo.dirstate.remove(f)
+        finally:
+            wlock.release()
+
+    def undelete(self, list):
+        pctxs = self.parents()
+        wlock = self._repo.wlock()
+        try:
+            for f in list:
+                if self._repo.dirstate[f] != 'r':
+                    self._repo.ui.warn(_("%s not removed!\n") % f)
+                else:
+                    fctx = f in pctxs[0] and pctxs[0] or pctxs[1]
+                    t = fctx.data()
+                    self._repo.wwrite(f, t, fctx.flags())
+                    self._repo.dirstate.normal(f)
+        finally:
+            wlock.release()
+
+    def copy(self, source, dest):
+        p = self._repo.wjoin(dest)
+        if not (os.path.exists(p) or os.path.islink(p)):
+            self._repo.ui.warn(_("%s does not exist!\n") % dest)
+        elif not (os.path.isfile(p) or os.path.islink(p)):
+            self._repo.ui.warn(_("copy failed: %s is not a file or a "
+                                 "symbolic link\n") % dest)
+        else:
+            wlock = self._repo.wlock()
+            try:
+                if self._repo.dirstate[dest] in '?r':
+                    self._repo.dirstate.add(dest)
+                self._repo.dirstate.copy(source, dest)
+            finally:
+                wlock.release()
+
 class workingfilectx(filectx):
     """A workingfilectx object makes access to data related to a particular
        file in the working directory convenient."""
--- a/mercurial/dispatch.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/dispatch.py	Tue Jun 08 15:52:56 2010 -0500
@@ -29,7 +29,7 @@
             sys.stderr.write(_("hg: parse error at %s: %s\n") %
                              (inst.args[1], inst.args[0]))
         else:
-            sys.stderr.write(_("hg: parse error: %s\n") % ints.args[0])
+            sys.stderr.write(_("hg: parse error: %s\n") % inst.args[0])
         return -1
     return _runcatch(u, args)
 
--- a/mercurial/localrepo.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/localrepo.py	Tue Jun 08 15:52:56 2010 -0500
@@ -16,7 +16,7 @@
 import tags as tagsmod
 import url as urlmod
 from lock import release
-import weakref, stat, errno, os, time, inspect
+import weakref, errno, os, time, inspect
 propertycache = util.propertycache
 
 class localrepository(repo.repository):
@@ -210,7 +210,7 @@
         writetags(fp, names, encoding.fromlocal, prevtags)
 
         if '.hgtags' not in self.dirstate:
-            self.add(['.hgtags'])
+            self[None].add(['.hgtags'])
 
         m = matchmod.exact(self.root, '', ['.hgtags'])
         tagnode = self.commit(message, user, date, extra=extra, match=m)
@@ -1112,103 +1112,6 @@
         [l.sort() for l in r]
         return r
 
-    def add(self, list):
-        wlock = self.wlock()
-        try:
-            rejected = []
-            for f in list:
-                p = self.wjoin(f)
-                try:
-                    st = os.lstat(p)
-                except:
-                    self.ui.warn(_("%s does not exist!\n") % f)
-                    rejected.append(f)
-                    continue
-                if st.st_size > 10000000:
-                    self.ui.warn(_("%s: up to %d MB of RAM may be required "
-                                   "to manage this file\n"
-                                   "(use 'hg revert %s' to cancel the "
-                                   "pending addition)\n")
-                                   % (f, 3 * st.st_size // 1000000, f))
-                if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
-                    self.ui.warn(_("%s not added: only files and symlinks "
-                                   "supported currently\n") % f)
-                    rejected.append(p)
-                elif self.dirstate[f] in 'amn':
-                    self.ui.warn(_("%s already tracked!\n") % f)
-                elif self.dirstate[f] == 'r':
-                    self.dirstate.normallookup(f)
-                else:
-                    self.dirstate.add(f)
-            return rejected
-        finally:
-            wlock.release()
-
-    def forget(self, list):
-        wlock = self.wlock()
-        try:
-            for f in list:
-                if self.dirstate[f] != 'a':
-                    self.ui.warn(_("%s not added!\n") % f)
-                else:
-                    self.dirstate.forget(f)
-        finally:
-            wlock.release()
-
-    def remove(self, list, unlink=False):
-        if unlink:
-            for f in list:
-                try:
-                    util.unlink(self.wjoin(f))
-                except OSError, inst:
-                    if inst.errno != errno.ENOENT:
-                        raise
-        wlock = self.wlock()
-        try:
-            for f in list:
-                if unlink and os.path.exists(self.wjoin(f)):
-                    self.ui.warn(_("%s still exists!\n") % f)
-                elif self.dirstate[f] == 'a':
-                    self.dirstate.forget(f)
-                elif f not in self.dirstate:
-                    self.ui.warn(_("%s not tracked!\n") % f)
-                else:
-                    self.dirstate.remove(f)
-        finally:
-            wlock.release()
-
-    def undelete(self, list):
-        manifests = [self.manifest.read(self.changelog.read(p)[0])
-                     for p in self.dirstate.parents() if p != nullid]
-        wlock = self.wlock()
-        try:
-            for f in list:
-                if self.dirstate[f] != 'r':
-                    self.ui.warn(_("%s not removed!\n") % f)
-                else:
-                    m = f in manifests[0] and manifests[0] or manifests[1]
-                    t = self.file(f).read(m[f])
-                    self.wwrite(f, t, m.flags(f))
-                    self.dirstate.normal(f)
-        finally:
-            wlock.release()
-
-    def copy(self, source, dest):
-        p = self.wjoin(dest)
-        if not (os.path.exists(p) or os.path.islink(p)):
-            self.ui.warn(_("%s does not exist!\n") % dest)
-        elif not (os.path.isfile(p) or os.path.islink(p)):
-            self.ui.warn(_("copy failed: %s is not a file or a "
-                           "symbolic link\n") % dest)
-        else:
-            wlock = self.wlock()
-            try:
-                if self.dirstate[dest] in '?r':
-                    self.dirstate.add(dest)
-                self.dirstate.copy(source, dest)
-            finally:
-                wlock.release()
-
     def heads(self, start=None):
         heads = self.changelog.heads(start)
         # sort the output in rev descending order
--- a/mercurial/parser.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/parser.py	Tue Jun 08 15:52:56 2010 -0500
@@ -33,8 +33,8 @@
     def _match(self, m):
         'make sure the tokenizer matches an end condition'
         if self.current[0] != m:
-            raise error.ParseError("unexpected token: %s" % self.current[2],
-                                   pos)
+            raise error.ParseError("unexpected token: %s" % self.current[0],
+                                   self.current[2])
         self._advance()
     def _parse(self, bind=0):
         token, value, pos = self._advance()
--- a/mercurial/patch.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/patch.py	Tue Jun 08 15:52:56 2010 -0500
@@ -1226,10 +1226,13 @@
             copies.append((gp.oldpath, gp.path))
         elif gp.op == 'DELETE':
             removes.add(gp.path)
+
+    wctx = repo[None]
     for src, dst in copies:
-        repo.copy(src, dst)
+        wctx.copy(src, dst)
     if (not similarity) and removes:
-        repo.remove(sorted(removes), True)
+        wctx.remove(sorted(removes), True)
+
     for f in patches:
         gp = patches[f]
         if gp and gp.mode:
--- a/mercurial/revset.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/revset.py	Tue Jun 08 15:52:56 2010 -0500
@@ -288,7 +288,6 @@
                 continue
     else:
         for r in subset:
-            c = repo[r]
             for f in repo[r].manifest():
                 if m(f):
                     s.append(r)
--- a/mercurial/templater.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/templater.py	Tue Jun 08 15:52:56 2010 -0500
@@ -17,7 +17,7 @@
     if isinstance(thing, str):
         yield thing
     elif not hasattr(thing, '__iter__'):
-        if i is not None:
+        if thing is not None:
             yield str(thing)
     else:
         for i in thing:
--- a/mercurial/ui.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/ui.py	Tue Jun 08 15:52:56 2010 -0500
@@ -228,7 +228,7 @@
         if result is None:
             result = default or []
         if isinstance(result, basestring):
-            result = _configlist(result)
+            result = _configlist(result.lstrip(' ,\n'))
             if result is None:
                 result = default or []
         return result
--- a/mercurial/win32.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/mercurial/win32.py	Tue Jun 08 15:52:56 2010 -0500
@@ -32,7 +32,7 @@
                 pass
             # Fake hardlinking error
             raise OSError(errno.EINVAL, 'Hardlinking not supported')
-    except pywintypes.error, details:
+    except pywintypes.error:
         raise OSError(errno.EINVAL, 'target implements hardlinks improperly')
     except NotImplementedError: # Another fake error win Win98
         raise OSError(errno.EINVAL, 'Hardlinking not supported')
--- a/tests/test-context.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/tests/test-context.py	Tue Jun 08 15:52:56 2010 -0500
@@ -13,7 +13,7 @@
 os.utime('foo', (1000, 1000))
 
 # add+commit 'foo'
-repo.add(['foo'])
+repo[None].add(['foo'])
 repo.commit(text='commit1', date="0 0")
 
 print "workingfilectx.date =", repo[None]['foo'].date()
--- a/tests/test-revlog-ancestry.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/tests/test-revlog-ancestry.py	Tue Jun 08 15:52:56 2010 -0500
@@ -13,7 +13,7 @@
     f = open(name, 'w')
     f.write('%s\n' % name)
     f.close()
-    repo.add([name])
+    repo[None].add([name])
     commit(name, time)
 
 def update(rev):
--- a/tests/test-ui-config.py	Tue Jun 08 15:52:41 2010 -0500
+++ b/tests/test-ui-config.py	Tue Jun 08 15:52:56 2010 -0500
@@ -24,6 +24,7 @@
     'lists.list15=" just with starting quotation',
     'lists.list16="longer quotation" with "no ending quotation',
     'lists.list17=this is \\" "not a quotation mark"',
+    'lists.list18=\n \n\nding\ndong',
 ])
 
 print repr(testui.configitems('values'))
@@ -62,6 +63,7 @@
 print repr(testui.configlist('lists', 'list15'))
 print repr(testui.configlist('lists', 'list16'))
 print repr(testui.configlist('lists', 'list17'))
+print repr(testui.configlist('lists', 'list18'))
 print repr(testui.configlist('lists', 'unknown'))
 print repr(testui.configlist('lists', 'unknown', ''))
 print repr(testui.configlist('lists', 'unknown', 'foo'))
--- a/tests/test-ui-config.py.out	Tue Jun 08 15:52:41 2010 -0500
+++ b/tests/test-ui-config.py.out	Tue Jun 08 15:52:56 2010 -0500
@@ -1,5 +1,5 @@
 [('string', 'string value'), ('bool1', 'true'), ('bool2', 'false')]
-[('list1', 'foo'), ('list2', 'foo bar baz'), ('list3', 'alice, bob'), ('list4', 'foo bar baz alice, bob'), ('list5', 'abc d"ef"g "hij def"'), ('list6', '"hello world", "how are you?"'), ('list7', 'Do"Not"Separate'), ('list8', '"Do"Separate'), ('list9', '"Do\\"NotSeparate"'), ('list10', 'string "with extraneous" quotation mark"'), ('list11', 'x, y'), ('list12', '"x", "y"'), ('list13', '""" key = "x", "y" """'), ('list14', ',,,,     '), ('list15', '" just with starting quotation'), ('list16', '"longer quotation" with "no ending quotation'), ('list17', 'this is \\" "not a quotation mark"')]
+[('list1', 'foo'), ('list2', 'foo bar baz'), ('list3', 'alice, bob'), ('list4', 'foo bar baz alice, bob'), ('list5', 'abc d"ef"g "hij def"'), ('list6', '"hello world", "how are you?"'), ('list7', 'Do"Not"Separate'), ('list8', '"Do"Separate'), ('list9', '"Do\\"NotSeparate"'), ('list10', 'string "with extraneous" quotation mark"'), ('list11', 'x, y'), ('list12', '"x", "y"'), ('list13', '""" key = "x", "y" """'), ('list14', ',,,,     '), ('list15', '" just with starting quotation'), ('list16', '"longer quotation" with "no ending quotation'), ('list17', 'this is \\" "not a quotation mark"'), ('list18', '\n \n\nding\ndong')]
 ---
 'string value'
 'true'
@@ -31,6 +31,7 @@
 ['"', 'just', 'with', 'starting', 'quotation']
 ['longer quotation', 'with', '"no', 'ending', 'quotation']
 ['this', 'is', '"', 'not a quotation mark']
+['ding', 'dong']
 []
 []
 ['foo']