changeset 2298:4be9a79b49b1

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Wed, 17 May 2006 13:21:36 -0500
parents ccd5f17f1eea (current diff) 936b615eb44e (diff)
children b3a08ccfb593 685597676a13 c58a403aa830 dec7aa404dcf
files
diffstat 47 files changed, 1366 insertions(+), 159 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgk	Wed May 10 17:05:43 2006 -0500
+++ b/contrib/hgk	Wed May 17 13:21:36 2006 -0500
@@ -196,6 +196,7 @@
     }
     foreach line [split $contents "\n"] {
 	if {$inhdr} {
+	    set line [split $line]
 	    if {$line == {}} {
 		set inhdr 0
 	    } else {
@@ -203,11 +204,11 @@
 		if {$tag == "author"} {
 		    set x [expr {[llength $line] - 2}]
 		    set audate [lindex $line $x]
-		    set auname [lrange $line 1 [expr {$x - 1}]]
+		    set auname [join [lrange $line 1 [expr {$x - 1}]]]
 		} elseif {$tag == "committer"} {
 		    set x [expr {[llength $line] - 2}]
 		    set comdate [lindex $line $x]
-		    set comname [lrange $line 1 [expr {$x - 1}]]
+		    set comname [join [lrange $line 1 [expr {$x - 1}]]]
 		}
 	    }
 	} else {
--- a/contrib/win32/ReadMe.html	Wed May 10 17:05:43 2006 -0500
+++ b/contrib/win32/ReadMe.html	Wed May 17 13:21:36 2006 -0500
@@ -14,7 +14,7 @@
   </head>
 
   <body>
-    <h1>Mercurial version 0.8.1 for Windows</h1>
+    <h1>Mercurial version 0.9 for Windows</h1>
 
     <p>Welcome to Mercurial for Windows!</p>
 
--- a/contrib/win32/mercurial.iss	Wed May 10 17:05:43 2006 -0500
+++ b/contrib/win32/mercurial.iss	Wed May 17 13:21:36 2006 -0500
@@ -4,7 +4,7 @@
 [Setup]
 AppCopyright=Copyright 2005, 2006 Matt Mackall and others
 AppName=Mercurial
-AppVerName=Mercurial version 0.8.1
+AppVerName=Mercurial version 0.9
 InfoAfterFile=contrib/win32/postinstall.txt
 LicenseFile=COPYING
 ShowLanguageDialog=yes
@@ -14,10 +14,10 @@
 AppUpdatesURL=http://www.selenic.com/mercurial
 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
 AppContact=mercurial@selenic.com
-OutputBaseFilename=Mercurial-0.8.1
+OutputBaseFilename=Mercurial-0.9
 DefaultDirName={sd}\Mercurial
 SourceDir=C:\hg\hg-release
-VersionInfoVersion=0.8.1
+VersionInfoVersion=0.9
 VersionInfoDescription=Mercurial distributed SCM
 VersionInfoCopyright=Copyright 2005, 2006 Matt Mackall and others
 VersionInfoCompany=Matt Mackall and others
--- a/contrib/win32/postinstall.txt	Wed May 10 17:05:43 2006 -0500
+++ b/contrib/win32/postinstall.txt	Wed May 17 13:21:36 2006 -0500
@@ -4,10 +4,47 @@
 For configuration and usage directions, please read the ReadMe.html
 file that comes with this package.
 
-
 Release Notes
 -------------
 
+2006-05-10  v0.9
+
+* Major changes between Mercurial 0.8.1 and 0.9:
+
+  - The repository file format has been improved.
+    - This has resulted in an average 40% reduction in disk space    usage.
+    - The new format (called RevlogNG) is now the default.
+    - Mercurial works perfectly with both the old and new repository
+      file formats. It can transfer changes transparently between
+      repositories of either format.
+    - To use the new repository format, simply use `hg clone --pull` to
+      clone an existing repository.
+    - Note: Versions 0.8.1 and earlier of Mercurial cannot read
+      RevlogNG repositories directly, but they can `clone`, `pull`
+      from, and `push` to servers that are serving RevlogNG
+      repositories.
+  - Memory usage has been improved by over 50% for many common operations.
+  - Substantial performance improvements on large repositories.
+  - New commands:
+    - 'archive' - generate a directory tree snapshot, tarball, or zip
+      file of a revision
+  - Deprecated commands:
+    - 'addremove' - replaced by 'add' and 'remove --after'
+    - 'forget' - replaced by 'revert'
+    - 'undo' - replaced by 'rollback'
+  - New extensions:
+    - Bugzilla integration hook
+    - Email notification hook
+  - Nested repositories are now supported. Mercurial will not recurse
+    into a subdirectory that contains a '.hg' directory. It is treated
+    as a separate repository.
+  - The standalone web server, 'hg serve', is now threaded, so it can
+    talk to multiple clients at a time.
+  - The web server can now display a "message of the day".
+  - Support added for hooks written in Python.
+  - Many improvements and clarifications to built-in help.
+
+
 2006-04-07  v0.8.1
 
 * Major changes from 0.8 to 0.8.1:
--- a/doc/hgrc.5.txt	Wed May 10 17:05:43 2006 -0500
+++ b/doc/hgrc.5.txt	Wed May 17 13:21:36 2006 -0500
@@ -135,6 +135,20 @@
   from;;
     Optional.  Email address to use in "From" header and SMTP envelope
     of outgoing messages.
+  method;;
+    Optional.  Method to use to send email messages.  If value is
+    "smtp" (default), use SMTP (see section "[mail]" for
+    configuration).  Otherwise, use as name of program to run that
+    acts like sendmail (takes "-f" option for sender, list of
+    recipients on command line, message on stdin).  Normally, setting
+    this to "sendmail" or "/usr/sbin/sendmail" is enough to use
+    sendmail to send messages.
+
+  Email example:
+
+    [email]
+    from = Joseph User <joe.user@example.com>
+    method = /usr/sbin/sendmail
 
 extensions::
   Mercurial has an extension mechanism for adding new features. To
@@ -219,15 +233,24 @@
     commit to proceed.  Non-zero status will cause the transaction to
     be rolled back.  ID of changeset is in $HG_NODE.  Parent changeset
     IDs are in $HG_PARENT1 and $HG_PARENT2.
+  preupdate;;
+    Run before updating the working directory.  Exit status 0 allows
+    the update to proceed.  Non-zero status will prevent the update.
+    Changeset ID of first new parent is in $HG_PARENT1.  If merge, ID
+    of second new parent is in $HG_PARENT2.
   tag;;
     Run after a tag is created.  ID of tagged changeset is in
     $HG_NODE.  Name of tag is in $HG_TAG.  Tag is local if
     $HG_LOCAL=1, in repo if $HG_LOCAL=0.
+  update;;
+    Run after updating the working directory.  Changeset ID of first
+    new parent is in $HG_PARENT1.  If merge, ID of second new parent
+    is in $HG_PARENT2.  If update succeeded, $HG_ERROR=0.  If update
+    failed (e.g. because conflicts not resolved), $HG_ERROR=1.
 
-  In earlier releases, the names of hook environment variables did not
-  have a "HG_" prefix.  These unprefixed names are still provided in
-  the environment for backwards compatibility, but their use is
-  deprecated, and they will be removed in a future release.
+  Note: In earlier releases, the names of hook environment variables
+  did not have a "HG_" prefix.  The old unprefixed names are no longer
+  provided in the environment.
 
   The syntax for Python hooks is as follows:
 
@@ -279,7 +302,15 @@
 paths::
   Assigns symbolic names to repositories.  The left side is the
   symbolic name, and the right gives the directory or URL that is the
-  location of the repository.
+  location of the repository.  Default paths can be declared by
+ setting the following entries.
+  default;;
+    Directory or URL to use when pulling if no source is specified.
+    Default is set to repository from which the current repository
+    was cloned.
+  default-push;;
+    Optional.  Directory or URL to use when pushing if no destination
+    is specified.
 
 ui::
   User interface controls.
--- a/hgext/mq.py	Wed May 10 17:05:43 2006 -0500
+++ b/hgext/mq.py	Wed May 17 13:21:36 2006 -0500
@@ -281,7 +281,8 @@
                 message = '\n'.join(message)
 
             try:
-                f = os.popen("patch -p1 --no-backup-if-mismatch < '%s'" % (pf))
+                pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
+                f = os.popen("%s -p1 --no-backup-if-mismatch < '%s'" % (pp, pf))
             except:
                 self.ui.warn("patch failed, unable to continue (try -v)\n")
                 err = 1
--- a/hgext/notify.py	Wed May 10 17:05:43 2006 -0500
+++ b/hgext/notify.py	Wed May 17 13:21:36 2006 -0500
@@ -228,14 +228,13 @@
             mail = self.ui.sendmail()
             mail.sendmail(templater.email(msg['From']), self.subs, msgtext)
 
-    def diff(self, node):
+    def diff(self, node, ref):
         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
         if maxdiff == 0:
             return
         fp = templater.stringio()
         prev = self.repo.changelog.parents(node)[0]
-        commands.dodiff(fp, self.ui, self.repo, prev,
-                        self.repo.changelog.tip())
+        commands.dodiff(fp, self.ui, self.repo, prev, ref)
         difflines = fp.getvalue().splitlines(1)
         if maxdiff > 0 and len(difflines) > maxdiff:
             self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
@@ -260,8 +259,9 @@
         count = end - start
         for rev in xrange(start, end):
             n.node(repo.changelog.node(rev))
+        n.diff(node, repo.changelog.tip())
     else:
         count = 1
         n.node(node)
-    n.diff(node)
+        n.diff(node, node)
     n.send(node, count)
--- a/hgext/patchbomb.py	Wed May 10 17:05:43 2006 -0500
+++ b/hgext/patchbomb.py	Wed May 17 13:21:36 2006 -0500
@@ -254,8 +254,6 @@
         else:
             ui.status('Sending ', m['Subject'], ' ...\n')
             mail.sendmail(sender, to + cc, m.as_string(0))
-    if not opts['test'] and not opts['mbox']:
-        mail.close()
 
 cmdtable = {
     'email':
--- a/mercurial/bundlerepo.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/bundlerepo.py	Wed May 17 13:21:36 2006 -0500
@@ -13,7 +13,7 @@
 from node import *
 from i18n import gettext as _
 from demandload import demandload
-demandload(globals(), "changegroup util os struct")
+demandload(globals(), "changegroup util os struct bz2 tempfile")
 
 import localrepo, changelog, manifest, filelog, revlog
 
@@ -50,7 +50,7 @@
                 continue
             for p in (p1, p2):
                 if not p in self.nodemap:
-                    raise RevlogError(_("unknown parent %s") % short(p1))
+                    raise revlog.RevlogError(_("unknown parent %s") % short(p1))
             if linkmapper is None:
                 link = n
             else:
@@ -76,12 +76,12 @@
             return False
         return rev in self.basemap
     def bundlebase(self, rev): return self.basemap[rev]
-    def chunk(self, rev, df=None):
+    def chunk(self, rev, df=None, cachelen=4096):
         # Warning: in case of bundle, the diff is against bundlebase,
         # not against rev - 1
         # XXX: could use some caching
         if not self.bundle(rev):
-            return revlog.revlog.chunk(self, rev)
+            return revlog.revlog.chunk(self, rev, df, cachelen)
         self.bundlefile.seek(self.start(rev))
         return self.bundlefile.read(self.length(rev))
 
@@ -123,8 +123,8 @@
 
         p1, p2 = self.parents(node)
         if node != revlog.hash(text, p1, p2):
-            raise RevlogError(_("integrity check failed on %s:%d")
-                          % (self.datafile, self.rev(node)))
+            raise revlog.RevlogError(_("integrity check failed on %s:%d")
+                                     % (self.datafile, self.rev(node)))
 
         self.cache = (node, self.rev(node), text)
         return text
@@ -159,19 +159,38 @@
 class bundlerepository(localrepo.localrepository):
     def __init__(self, ui, path, bundlename):
         localrepo.localrepository.__init__(self, ui, path)
-        f = open(bundlename, "rb")
-        s = util.fstat(f)
-        self.bundlefile = f
+        self.tempfile = None
+        self.bundlefile = open(bundlename, "rb")
         header = self.bundlefile.read(6)
         if not header.startswith("HG"):
             raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
         elif not header.startswith("HG10"):
             raise util.Abort(_("%s: unknown bundle version") % bundlename)
         elif header == "HG10BZ":
-            raise util.Abort(_("%s: compressed bundle not supported")
-                             % bundlename)
+            fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
+                                            suffix=".hg10un", dir=self.path)
+            self.tempfile = temp
+            fptemp = os.fdopen(fdtemp, 'wb')
+            def generator(f):
+                zd = bz2.BZ2Decompressor()
+                zd.decompress("BZ")
+                for chunk in f:
+                    yield zd.decompress(chunk)
+            gen = generator(util.filechunkiter(self.bundlefile, 4096))
+
+            try:
+                fptemp.write("HG10UN")
+                for chunk in gen:
+                    fptemp.write(chunk)
+            finally:
+                fptemp.close()
+                self.bundlefile.close()
+
+            self.bundlefile = open(self.tempfile, "rb")
+            # seek right after the header
+            self.bundlefile.seek(6)
         elif header == "HG10UN":
-            # uncompressed bundle supported
+            # nothing to do
             pass
         else:
             raise util.Abort(_("%s: unknown bundle compression type")
@@ -205,3 +224,9 @@
     def close(self):
         """Close assigned bundle file immediately."""
         self.bundlefile.close()
+
+    def __del__(self):
+        if not self.bundlefile.closed:
+            self.bundlefile.close()
+        if self.tempfile is not None:
+            os.unlink(self.tempfile)
--- a/mercurial/commands.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/commands.py	Wed May 17 13:21:36 2006 -0500
@@ -756,13 +756,20 @@
 def backout(ui, repo, rev, **opts):
     '''reverse effect of earlier changeset
 
-    Commit the backed out changes as a new changeset.
+    Commit the backed out changes as a new changeset.  The new
+    changeset is a child of the backed out changeset.
 
     If you back out a changeset other than the tip, a new head is
-    created.  The --merge option remembers the parent of the working
-    directory before starting the backout, then merges the new head
-    with it afterwards, to save you from doing this by hand.  The
-    result of this merge is not committed, as for a normal merge.'''
+    created.  This head is the parent of the working directory.  If
+    you back out an old changeset, your working directory will appear
+    old after the backout.  You should merge the backout changeset
+    with another head.
+
+    The --merge option remembers the parent of the working directory
+    before starting the backout, then merges the new head with that
+    changeset afterwards.  This saves you from doing the merge by
+    hand.  The result of this merge is not committed, as for a normal
+    merge.'''
 
     bail_if_changed(repo)
     op1, op2 = repo.dirstate.parents()
@@ -782,6 +789,7 @@
     commit_opts['addremove'] = False
     if not commit_opts['message'] and not commit_opts['logfile']:
         commit_opts['message'] = _("Backed out changeset %s") % (hex(node))
+        commit_opts['force_editor'] = True
     commit(ui, repo, **commit_opts)
     def nice(node):
         return '%d:%s' % (repo.changelog.rev(node), short(node))
@@ -789,7 +797,7 @@
               (nice(repo.changelog.tip()), nice(node)))
     if opts['merge'] and op1 != node:
         ui.status(_('merging with changeset %s\n') % nice(op1))
-        update(ui, repo, hex(op1), **opts)
+        doupdate(ui, repo, hex(op1), **opts)
 
 def bundle(ui, repo, fname, dest="default-push", **opts):
     """create a changegroup file
@@ -939,7 +947,7 @@
     f.close()
 
     if not opts['noupdate']:
-        update(repo.ui, repo)
+        doupdate(repo.ui, repo)
 
     d.close()
 
@@ -980,7 +988,8 @@
     else:
         files = []
     try:
-        repo.commit(files, message, opts['user'], opts['date'], match)
+        repo.commit(files, message, opts['user'], opts['date'], match,
+                    force_editor=opts.get('force_editor'))
     except ValueError, inst:
         raise util.Abort(str(inst))
 
@@ -1296,10 +1305,11 @@
     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
     ui.write("digraph G {\n")
     for i in range(r.count()):
-        e = r.index[i]
-        ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
-        if e[5] != nullid:
-            ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
+        node = r.node(i)
+        pp = r.parents(node)
+        ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
+        if pp[1] != nullid:
+            ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
     ui.write("}\n")
 
 def debugrename(ui, repo, file, rev=None):
@@ -1947,7 +1957,7 @@
     marked as changed for the next commit and a commit must be
     performed before any further updates are allowed.
     """
-    return update(ui, repo, node=node, merge=True, **opts)
+    return doupdate(ui, repo, node=node, merge=True, **opts)
 
 def outgoing(ui, repo, dest="default-push", **opts):
     """show changesets not found in destination
@@ -2026,7 +2036,7 @@
         return
     if optupdate:
         if modheads == 1:
-            return update(ui, repo)
+            return doupdate(ui, repo)
         else:
             ui.status(_("not updating, since new heads added\n"))
     if modheads > 1:
@@ -2268,6 +2278,7 @@
                            'you must specify the revision to revert to'))
     else:
         node = parent
+    pmf = None
     mf = repo.manifest.read(repo.changelog.read(node)[0])
 
     wlock = repo.wlock()
@@ -2350,7 +2361,12 @@
                 if exact: ui.warn(_('no changes needed to %s\n' % rel))
                 continue
             if not in_mf:
-                handle(remove, False)
+                if pmf is None:
+                    # only need parent manifest in this unlikely case,
+                    # so do not read by default
+                    pmf = repo.manifest.read(repo.changelog.read(parent)[0])
+                if abs in pmf:
+                    handle(remove, False)
         update[abs] = True
 
     repo.dirstate.forget(forget[0])
@@ -2725,15 +2741,19 @@
     there is a linear relationship between the current version and the
     requested version, the result is the requested version.
 
-    Otherwise the result is a merge between the contents of the
-    current working directory and the requested version. Files that
-    changed between either parent are marked as changed for the next
-    commit and a commit must be performed before any further updates
-    are allowed.
+    To merge the working directory with another revision, use the
+    merge command.
 
     By default, update will refuse to run if doing so would require
     merging or discarding local changes.
     """
+    if merge:
+        ui.warn(_('(the -m/--merge option is deprecated; '
+                  'use the merge command instead)\n'))
+    return doupdate(ui, repo, node, merge, clean, force, branch, **opts)
+
+def doupdate(ui, repo, node=None, merge=False, clean=False, force=None,
+             branch=None, **opts):
     if branch:
         br = repo.branchlookup(branch=branch)
         found = []
@@ -3100,7 +3120,7 @@
     "^update|up|checkout|co":
         (update,
          [('b', 'branch', '', _('checkout the head of a specific branch')),
-          ('m', 'merge', None, _('allow merging of branches')),
+          ('m', 'merge', None, _('allow merging of branches (DEPRECATED)')),
           ('C', 'clean', None, _('overwrite locally modified files')),
           ('f', 'force', None, _('force a merge with outstanding changes'))],
          _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
@@ -3116,6 +3136,7 @@
      _('do not prompt, assume \'yes\' for any required answers')),
     ('q', 'quiet', None, _('suppress output')),
     ('v', 'verbose', None, _('enable additional output')),
+    ('', 'config', [], _('set/override config option')),
     ('', 'debug', None, _('enable debugging output')),
     ('', 'debugger', None, _('start debugger')),
     ('', 'traceback', None, _('print traceback on exception')),
@@ -3280,7 +3301,8 @@
             atexit.register(print_time)
 
         u.updateopts(options["verbose"], options["debug"], options["quiet"],
-                     not options["noninteractive"], options["traceback"])
+                     not options["noninteractive"], options["traceback"],
+                     options["config"])
 
         # enter the debugger before command execution
         if options['debugger']:
--- a/mercurial/hgweb.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/hgweb.py	Wed May 17 13:21:36 2006 -0500
@@ -684,7 +684,7 @@
         mf = self.repo.manifest.read(cs[0])
 
         def diff(**map):
-            yield self.diff(p1, n, file)
+            yield self.diff(p1, n, [file])
 
         yield self.t("filediff",
                      file=file,
--- a/mercurial/httprepo.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/httprepo.py	Wed May 17 13:21:36 2006 -0500
@@ -11,6 +11,25 @@
 from demandload import *
 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
 
+class passwordmgr(urllib2.HTTPPasswordMgr):
+    def __init__(self, ui):
+        urllib2.HTTPPasswordMgr.__init__(self)
+        self.ui = ui
+
+    def find_user_password(self, realm, authuri):
+        authinfo = urllib2.HTTPPasswordMgr.find_user_password(
+            self, realm, authuri)
+        if authinfo != (None, None):
+            return authinfo
+
+        self.ui.write(_("http authorization required\n"))
+        self.ui.status(_("realm: %s\n") % realm)
+        user = self.ui.prompt(_("user:"), default=None)
+        passwd = self.ui.getpass()
+
+        self.add_password(realm, authuri, user, passwd)
+        return (user, passwd)
+
 class httprepository(remoterepository):
     def __init__(self, ui, path):
         # fix missing / after hostname
@@ -53,13 +72,21 @@
         if host and not no_proxy:
             proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
 
-        authinfo = None
+        proxyauthinfo = None
         if user and passwd:
             passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
             passmgr.add_password(None, host, user, passwd)
-            authinfo = urllib2.ProxyBasicAuthHandler(passmgr)
+            proxyauthinfo = urllib2.ProxyBasicAuthHandler(passmgr)
 
-        opener = urllib2.build_opener(proxy_handler, authinfo)
+        if ui.interactive:
+            passmgr = passwordmgr(ui)
+            opener = urllib2.build_opener(
+                proxy_handler, proxyauthinfo,
+                urllib2.HTTPBasicAuthHandler(passmgr),
+                urllib2.HTTPDigestAuthHandler(passmgr))
+        else:
+            opener = urllib2.build_opener(proxy_handler, proxyauthinfo)
+
         # 1.0 here is the _protocol_ version
         opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
         urllib2.install_opener(opener)
@@ -76,7 +103,10 @@
         q.update(args)
         qs = urllib.urlencode(q)
         cu = "%s?%s" % (self.url, qs)
-        resp = urllib2.urlopen(cu)
+        try:
+            resp = urllib2.urlopen(cu)
+        except httplib.HTTPException, inst:
+            raise IOError(None, _('http error while sending %s command') % cmd)
         proto = resp.headers['content-type']
 
         # accept old "text/plain" and "application/hg-changegroup" for now
--- a/mercurial/localrepo.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/localrepo.py	Wed May 17 13:21:36 2006 -0500
@@ -136,8 +136,7 @@
 
         def runhook(name, cmd):
             self.ui.note(_("running hook %s: %s\n") % (name, cmd))
-            env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()] +
-                       [(k.upper(), v) for k, v in args.iteritems()])
+            env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()])
             r = util.system(cmd, environ=env, cwd=self.root)
             if r:
                 desc, r = util.explain_exit(r)
@@ -446,7 +445,8 @@
             self.dirstate.setparents(n, nullid)
 
     def commit(self, files=None, text="", user=None, date=None,
-               match=util.always, force=False, lock=None, wlock=None):
+               match=util.always, force=False, lock=None, wlock=None,
+               force_editor=False):
         commit = []
         remove = []
         changed = []
@@ -535,8 +535,11 @@
         new.sort()
 
         user = user or self.ui.username()
-        if not text:
-            edittext = [""]
+        if not text or force_editor:
+            edittext = []
+            if text:
+                edittext.append(text)
+            edittext.append("")
             if p2 != nullid:
                 edittext.append("HG: branch merge")
             edittext.extend(["HG: changed %s" % f for f in changed])
@@ -1544,8 +1547,9 @@
                          " with %d changes to %d files%s\n")
                          % (changesets, revisions, files, heads))
 
-        self.hook('pretxnchangegroup', throw=True,
-                  node=hex(self.changelog.node(cor+1)), source=srctype)
+        if changesets > 0:
+            self.hook('pretxnchangegroup', throw=True,
+                      node=hex(self.changelog.node(cor+1)), source=srctype)
 
         tr.close()
 
@@ -1563,8 +1567,7 @@
                moddirstate=True, forcemerge=False, wlock=None, show_stats=True):
         pl = self.dirstate.parents()
         if not force and pl[1] != nullid:
-            self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
-            return 1
+            raise util.Abort(_("outstanding uncommitted merges"))
 
         err = False
 
@@ -1592,6 +1595,7 @@
         if allow and not forcemerge:
             if modified or added or removed:
                 raise util.Abort(_("outstanding uncommitted changes"))
+
         if not forcemerge and not force:
             for f in unknown:
                 if f in m2:
@@ -1765,6 +1769,13 @@
                 return 1
             branch_merge = True
 
+        xp1 = hex(p1)
+        xp2 = hex(p2)
+        if p2 == nullid: xxp2 = ''
+        else: xxp2 = xp2
+
+        self.hook('preupdate', throw=True, parent1=xp1, parent2=xxp2)
+
         # get the files we don't need to change
         files = get.keys()
         files.sort()
@@ -1785,8 +1796,6 @@
         failedmerge = []
         files = merge.keys()
         files.sort()
-        xp1 = hex(p1)
-        xp2 = hex(p2)
         for f in files:
             self.ui.status(_("merging %s\n") % f)
             my, other, flag = merge[f]
@@ -1850,6 +1859,7 @@
                 self.ui.status(_("There are unresolved merges with"
                                  " locally modified files.\n"))
 
+        self.hook('update', parent1=xp1, parent2=xxp2, error=int(err))
         return err
 
     def merge3(self, fn, my, other, p1, p2):
--- a/mercurial/revlog.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/revlog.py	Wed May 17 13:21:36 2006 -0500
@@ -376,12 +376,7 @@
                 self.index = lazyindex(parser)
                 self.nodemap = lazymap(parser)
             else:
-                i = f.read()
-                self.parseindex(i)
-            if self.inlinedata():
-                # we've already got the entire data file read in, save it
-                # in the chunk data
-                self.chunkcache = (0, i)
+                self.parseindex(f, st)
             if self.version != REVLOGV0:
                 e = list(self.index[0])
                 type = self.ngtype(e[0])
@@ -392,22 +387,47 @@
             self.index = []
 
 
-    def parseindex(self, data):
+    def parseindex(self, fp, st):
         s = struct.calcsize(self.indexformat)
-        l = len(data)
         self.index = []
         self.nodemap =  {nullid: -1}
         inline = self.inlinedata()
-        off = 0
         n = 0
-        while off < l:
-            e = struct.unpack(self.indexformat, data[off:off + s])
-            self.index.append(e)
-            self.nodemap[e[-1]] = n
-            n += 1
-            off += s
-            if inline:
-                off += e[1]
+        leftover = None
+        while True:
+            if st:
+                data = fp.read(65536)
+            else:
+                # hack for httprangereader, it doesn't do partial reads well
+                data = fp.read()
+            if not data:
+                break
+            if n == 0 and self.inlinedata():
+                # cache the first chunk
+                self.chunkcache = (0, data)
+            if leftover:
+                data = leftover + data
+                leftover = None
+            off = 0
+            l = len(data)
+            while off < l:
+                if l - off < s:
+                    leftover = data[off:]
+                    break
+                cur = data[off:off + s]
+                off += s
+                e = struct.unpack(self.indexformat, cur)
+                self.index.append(e)
+                self.nodemap[e[-1]] = n
+                n += 1
+                if inline:
+                    off += e[1]
+                    if off > l:
+                        # some things don't seek well, just read it
+                        fp.read(off - l)
+            if not st:
+                break
+                
 
     def ngoffset(self, q):
         if q & 0xFFFF:
@@ -1117,7 +1137,7 @@
 
             for p in (p1, p2):
                 if not p in self.nodemap:
-                    raise RevlogError(_("unknown parent %s") % short(p1))
+                    raise RevlogError(_("unknown parent %s") % short(p))
 
             if not chain:
                 # retrieve the parent revision of the delta chain
--- a/mercurial/ui.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/ui.py	Wed May 17 13:21:36 2006 -0500
@@ -8,7 +8,8 @@
 import ConfigParser
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "errno os re smtplib socket sys tempfile util")
+demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
+demandload(globals(), "templater util")
 
 class ui(object):
     def __init__(self, verbose=False, debug=False, quiet=False,
@@ -46,12 +47,23 @@
         return getattr(self.parentui, key)
 
     def updateopts(self, verbose=False, debug=False, quiet=False,
-                   interactive=True, traceback=False):
+                   interactive=True, traceback=False, config=[]):
         self.quiet = (self.quiet or quiet) and not verbose and not debug
         self.verbose = (self.verbose or verbose) or debug
         self.debugflag = (self.debugflag or debug)
         self.interactive = (self.interactive and interactive)
         self.traceback = self.traceback or traceback
+        for cfg in config:
+            try:
+                name, value = cfg.split('=', 1)
+                section, name = name.split('.', 1)
+                if not self.cdata.has_section(section):
+                    self.cdata.add_section(section)
+                if not section or not name:
+                    raise IndexError
+                self.cdata.set(section, name, value)
+            except (IndexError, ValueError):
+                raise util.Abort(_('malformed --config option: %s') % cfg)
 
     def readconfig(self, fn, root=None):
         if isinstance(fn, basestring):
@@ -224,15 +236,18 @@
 
     def readline(self):
         return sys.stdin.readline()[:-1]
-    def prompt(self, msg, pat, default="y"):
+    def prompt(self, msg, pat=None, default="y"):
         if not self.interactive: return default
         while 1:
             self.write(msg, " ")
             r = self.readline()
-            if re.match(pat, r):
+            if not pat or re.match(pat, r):
                 return r
             else:
                 self.write(_("unrecognized response\n"))
+    def getpass(self, prompt=None, default=None):
+        if not self.interactive: return default
+        return getpass.getpass(prompt or _('password: '))
     def status(self, *msg):
         if not self.quiet: self.write(*msg)
     def warn(self, *msg):
@@ -267,15 +282,56 @@
         return t
 
     def sendmail(self):
-        s = smtplib.SMTP()
-        s.connect(host = self.config('smtp', 'host', 'mail'),
-                  port = int(self.config('smtp', 'port', 25)))
-        if self.configbool('smtp', 'tls'):
-            s.ehlo()
-            s.starttls()
-            s.ehlo()
-        username = self.config('smtp', 'username')
-        password = self.config('smtp', 'password')
-        if username and password:
-            s.login(username, password)
-        return s
+        '''send mail message. object returned has one method, sendmail.
+        call as sendmail(sender, list-of-recipients, msg).'''
+
+        def smtp():
+            '''send mail using smtp.'''
+
+            s = smtplib.SMTP()
+            mailhost = self.config('smtp', 'host')
+            if not mailhost:
+                raise util.Abort(_('no [smtp]host in hgrc - cannot send mail'))
+            mailport = int(self.config('smtp', 'port', 25))
+            self.note(_('sending mail: smtp host %s, port %s\n') %
+                      (mailhost, mailport))
+            s.connect(host=mailhost, port=mailport)
+            if self.configbool('smtp', 'tls'):
+                self.note(_('(using tls)\n'))
+                s.ehlo()
+                s.starttls()
+                s.ehlo()
+            username = self.config('smtp', 'username')
+            password = self.config('smtp', 'password')
+            if username and password:
+                self.note(_('(authenticating to mail server as %s)\n') %
+                          (username))
+                s.login(username, password)
+            return s
+
+        class sendmail(object):
+            '''send mail using sendmail.'''
+
+            def __init__(self, ui, program):
+                self.ui = ui
+                self.program = program
+
+            def sendmail(self, sender, recipients, msg):
+                cmdline = '%s -f %s %s' % (
+                    self.program, templater.email(sender),
+                    ' '.join(map(templater.email, recipients)))
+                self.ui.note(_('sending mail: %s\n') % cmdline)
+                fp = os.popen(cmdline, 'w')
+                fp.write(msg)
+                ret = fp.close()
+                if ret:
+                    raise util.Abort('%s %s' % (
+                        os.path.basename(self.program.split(None, 1)[0]),
+                        util.explain_exit(ret)[0]))
+
+        method = self.config('email', 'method', 'smtp')
+        if method == 'smtp':
+            mail = smtp()
+        else:
+            mail = sendmail(self, method)
+        return mail
--- a/mercurial/util.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/util.py	Wed May 17 13:21:36 2006 -0500
@@ -205,13 +205,15 @@
     """return the canonical path of myname, given cwd and root"""
     if root == os.sep:
         rootsep = os.sep
+    elif root.endswith(os.sep):
+        rootsep = root
     else:
         rootsep = root + os.sep
     name = myname
     if not os.path.isabs(name):
         name = os.path.join(root, cwd, name)
     name = os.path.normpath(name)
-    if name.startswith(rootsep):
+    if name != rootsep and name.startswith(rootsep):
         name = name[len(rootsep):]
         audit_path(name)
         return pconvert(name)
@@ -533,8 +535,16 @@
 
     def os_rcpath():
         '''return default os-specific hgrc search path'''
-        return system_rcpath() + [os.path.join(os.path.expanduser('~'),
-                                               'mercurial.ini')]
+        path = system_rcpath()
+        path.append(user_rcpath())
+        userprofile = os.environ.get('USERPROFILE')
+        if userprofile:
+            path.append(os.path.join(userprofile, 'mercurial.ini'))
+        return path
+
+    def user_rcpath():
+         '''return os-specific hgrc search path to the user dir'''
+         return os.path.join(os.path.expanduser('~'), 'mercurial.ini')
 
     def parse_patch_output(output_line):
         """parses the output produced by patch and returns the file name"""
@@ -597,7 +607,8 @@
     def os_rcpath():
         '''return default os-specific hgrc search path'''
         path = []
-        if len(sys.argv) > 0:
+        # old mod_python does not set sys.argv
+        if len(getattr(sys, 'argv', [])) > 0:
             path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
                                   '/../etc/mercurial'))
         path.extend(rcfiles('/etc/mercurial'))
--- a/mercurial/util_win32.py	Wed May 10 17:05:43 2006 -0500
+++ b/mercurial/util_win32.py	Wed May 17 13:21:36 2006 -0500
@@ -16,7 +16,7 @@
 from demandload import *
 from i18n import gettext as _
 demandload(globals(), 'errno os pywintypes win32con win32file win32process')
-demandload(globals(), 'cStringIO winerror')
+demandload(globals(), 'cStringIO win32com.shell:shell,shellcon winerror')
 
 class WinError:
     winerror_map = {
@@ -180,9 +180,24 @@
 def system_rcpath_win32():
     '''return default os-specific hgrc search path'''
     proc = win32api.GetCurrentProcess()
-    filename = win32process.GetModuleFileNameEx(proc, 0)
+    try:
+        # This will fail on windows < NT
+        filename = win32process.GetModuleFileNameEx(proc, 0)
+    except:
+        filename = win32api.GetModuleFileName(0)
     return [os.path.join(os.path.dirname(filename), 'mercurial.ini')]
 
+def user_rcpath():
+    '''return os-specific hgrc search path to the user dir'''
+    userdir = os.path.expanduser('~')
+    if userdir == '~':
+        # We are on win < nt: fetch the APPDATA directory location and use
+        # the parent directory as the user home dir.
+        appdir = shell.SHGetPathFromIDList(
+            qshell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA))
+        userdir = os.path.dirname(appdir)
+    return os.path.join(userdir, 'mercurial.ini')
+
 class posixfile_nt(object):
     '''file object with posix-like semantics.  on windows, normal
     files can not be deleted or renamed if they are open. must open
--- a/tests/README	Wed May 10 17:05:43 2006 -0500
+++ b/tests/README	Wed May 17 13:21:36 2006 -0500
@@ -16,10 +16,10 @@
 There are some tricky points here that you should be aware of when
 writing tests:
 
-- hg commit and hg up -m want user interaction
+- hg commit and hg merge want user interaction
 
   for commit use -m "text"
-  for hg up -m, set HGMERGE to something noninteractive (like true or merge)
+  for hg merge, set HGMERGE to something noninteractive (like true or merge)
 
 - changeset hashes will change based on user and date which make
   things like hg history output change
--- a/tests/run-tests.py	Wed May 10 17:05:43 2006 -0500
+++ b/tests/run-tests.py	Wed May 17 13:21:36 2006 -0500
@@ -242,24 +242,28 @@
 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
 
 try:
-    install_hg()
+    try:
+        install_hg()
 
-    tests = 0
-    failed = 0
+        tests = 0
+        failed = 0
 
-    if len(args) == 0:
-        args = os.listdir(".")
-    for test in args:
-        if test.startswith("test-"):
-            if '~' in test or re.search(r'\.(out|err)$', test):
-                continue
-            if not run_one(test):
-                failed += 1
-            tests += 1
+        if len(args) == 0:
+            args = os.listdir(".")
+        for test in args:
+            if test.startswith("test-"):
+                if '~' in test or re.search(r'\.(out|err)$', test):
+                    continue
+                if not run_one(test):
+                    failed += 1
+                tests += 1
 
-    print "\n# Ran %d tests, %d failed." % (tests, failed)
-    if coverage:
-        output_coverage()
+        print "\n# Ran %d tests, %d failed." % (tests, failed)
+        if coverage:
+            output_coverage()
+    except KeyboardInterrupt:
+        failed = True
+        print "\ninterrupted!"
 finally:
     cleanup_exit()
 
--- a/tests/test-backout.out	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-backout.out	Wed May 17 13:21:36 2006 -0500
@@ -1,19 +1,19 @@
 # basic operation
 adding a
-changeset 2:b38a34ddfd9f backs out changeset 1:a820f4f40a57
+changeset 2:c86754337410 backs out changeset 1:a820f4f40a57
 a
 # file that was removed is recreated
 adding a
 adding a
-changeset 2:44cd84c7349a backs out changeset 1:76862dcce372
+changeset 2:d2d961bd79f2 backs out changeset 1:76862dcce372
 content
 # backout of backout is as if nothing happened
 removing a
-changeset 3:0dd8a0ed5e99 backs out changeset 2:44cd84c7349a
+changeset 3:8a7eeb5ab5ce backs out changeset 2:d2d961bd79f2
 cat: a: No such file or directory
 # backout with merge
 adding a
-changeset 3:6c77ecc28460 backs out changeset 1:314f55b1bf23
+changeset 3:3c9e845b409c backs out changeset 1:314f55b1bf23
 merging with changeset 2:b66ea5b77abb
 merging a
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-bundle	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+hg init test
+cd test
+echo 0 > afile
+hg add afile
+hg commit -m "0.0" -d "1000000 0"
+echo 1 >> afile
+hg commit -m "0.1" -d "1000000 0"
+echo 2 >> afile
+hg commit -m "0.2" -d "1000000 0"
+echo 3 >> afile
+hg commit -m "0.3" -d "1000000 0"
+hg update -C 0
+echo 1 >> afile
+hg commit -m "1.1" -d "1000000 0"
+echo 2 >> afile
+hg commit -m "1.2" -d "1000000 0"
+echo "a line" > fred
+echo 3 >> afile
+hg add fred
+hg commit -m "1.3" -d "1000000 0"
+hg mv afile adifferentfile
+hg commit -m "1.3m" -d "1000000 0"
+hg update -C 3
+hg mv afile anotherfile
+hg commit -m "0.3m" -d "1000000 0"
+hg verify
+cd ..
+hg init empty
+hg -R test bundle full.hg empty
+hg -R test unbundle full.hg
+hg -R empty unbundle full.hg
+hg -R empty heads
+hg -R empty verify
+
+rm -rf empty
+hg init empty
+cd empty
+hg -R bundle://../full.hg log
+#doesn't work (yet ?)
+#hg -R bundle://../full.hg verify
+hg pull bundle://../full.hg
+cd ..
+
+rm -rf empty
+hg init empty
+hg clone -r 3 test partial
+hg clone partial partial2
+cd partial
+hg -R bundle://../full.hg log
+hg incoming bundle://../full.hg
+hg -R bundle://../full.hg outgoing ../partial2
+cd ..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-bundle.out	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,203 @@
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 9 changesets, 7 total revisions
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 0 changesets with 0 changes to 4 files
+(run 'hg update' to get a working copy)
+adding changesets
+adding manifests
+adding file changes
+added 9 changesets with 7 changes to 4 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+changeset:   8:836ac62537ab
+tag:         tip
+parent:      3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3m
+
+changeset:   7:80fe151401c2
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3m
+
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+4 files, 9 changesets, 7 total revisions
+changeset:   8:836ac62537ab
+tag:         tip
+parent:      3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3m
+
+changeset:   7:80fe151401c2
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3m
+
+changeset:   6:1e3f6b843bd6
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3
+
+changeset:   5:024e4e7df376
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.2
+
+changeset:   4:5f4f3ceb285e
+parent:      0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.1
+
+changeset:   3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3
+
+changeset:   2:d62976ca1e50
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.2
+
+changeset:   1:10b2180f755b
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.1
+
+changeset:   0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.0
+
+pulling from bundle://../full.hg
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 9 changesets with 7 changes to 4 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 4 changesets with 4 changes to 1 files
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+changeset:   8:836ac62537ab
+tag:         tip
+parent:      3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3m
+
+changeset:   7:80fe151401c2
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3m
+
+changeset:   6:1e3f6b843bd6
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3
+
+changeset:   5:024e4e7df376
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.2
+
+changeset:   4:5f4f3ceb285e
+parent:      0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.1
+
+changeset:   3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3
+
+changeset:   2:d62976ca1e50
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.2
+
+changeset:   1:10b2180f755b
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.1
+
+changeset:   0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.0
+
+searching for changes
+changeset:   4:5f4f3ceb285e
+parent:      0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.1
+
+changeset:   5:024e4e7df376
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.2
+
+changeset:   6:1e3f6b843bd6
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3
+
+changeset:   7:80fe151401c2
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3m
+
+changeset:   8:836ac62537ab
+tag:         tip
+parent:      3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3m
+
+searching for changes
+changeset:   4:5f4f3ceb285e
+parent:      0:5649c9d34dd8
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.1
+
+changeset:   5:024e4e7df376
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.2
+
+changeset:   6:1e3f6b843bd6
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3
+
+changeset:   7:80fe151401c2
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1.3m
+
+changeset:   8:836ac62537ab
+tag:         tip
+parent:      3:ac69c658229d
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0.3m
+
--- a/tests/test-conflict	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-conflict	Wed May 17 13:21:36 2006 -0500
@@ -10,7 +10,7 @@
 echo "something else" > a
 hg commit -m branch2 -d "1000000 0"
 HGMERGE=merge; export HGMERGE
-hg up -m 1
+hg merge 1
 hg id
 egrep -v ">>>|<<<" a
 hg status
--- a/tests/test-confused-revert	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-confused-revert	Wed May 17 13:21:36 2006 -0500
@@ -28,7 +28,7 @@
 echo foo-b > a
 hg commit -m "2b" -d "1000000 0"
 
-HGMERGE=true hg update -m 1
+HGMERGE=true hg merge 1
 
 echo "%%% should show foo-b"
 cat a
--- a/tests/test-excessive-merge	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-excessive-merge	Wed May 17 13:21:36 2006 -0500
@@ -17,12 +17,12 @@
 echo blah > b
 
 hg ci -m "branch b" -d "1000000 0"
-HGMERGE=true hg up -m 1
+HGMERGE=true hg merge 1
 
 hg ci -m "merge b/a -> blah" -d "1000000 0"
 
 hg co 1
-HGMERGE=true hg up -m 2
+HGMERGE=true hg merge 2
 hg ci -m "merge a/b -> blah" -d "1000000 0"
 
 hg log
@@ -43,4 +43,4 @@
 
 hg debugindex .hg/data/a.i
 
-hg verify
\ No newline at end of file
+hg verify
--- a/tests/test-filebranch	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-filebranch	Wed May 17 13:21:36 2006 -0500
@@ -41,7 +41,7 @@
 
 echo merging
 hg pull ../a
-env HGMERGE=../merge hg update -vm
+env HGMERGE=../merge hg merge -v
 
 echo 2m > foo
 echo 2b > baz
--- a/tests/test-flags	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-flags	Wed May 17 13:21:36 2006 -0500
@@ -27,7 +27,7 @@
 hg heads
 hg history
 
-hg -v co -m
+hg -v merge
 
 ls -l ../test[12]/a > foo
 cut -b 1-10 < foo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-globalopts	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+hg init a
+cd a
+echo a > a
+hg ci -A -d'1 0' -m a
+
+cd ..
+
+hg init b
+cd b
+echo b > b
+hg ci -A -d'1 0' -m b
+
+cd ..
+
+hg clone a c
+cd c
+hg pull -f ../b
+HGMERGE=merge hg merge
+
+cd ..
+
+echo %% -R/--repository
+hg -R a tip
+hg --repository b tip
+
+echo %% abbrev of long option
+hg --repo c tip
+
+echo %% --cwd
+hg --cwd a parents
+
+echo %% -y/--noninteractive - just be sure it is parsed
+hg --cwd a tip -q --noninteractive
+hg --cwd a tip -q -y
+
+echo %% -q/--quiet
+hg -R a -q tip
+hg -R b -q tip
+hg -R c --quiet parents
+
+echo %% -v/--verbose
+hg --cwd c head -v
+hg --cwd b tip --verbose
+
+echo %% --config
+hg --cwd c --config paths.quuxfoo=bar paths | grep -q quuxfoo && echo quuxfoo
+hg --cwd c --config '' tip -q
+hg --cwd c --config a.b tip -q
+hg --cwd c --config a tip -q
+hg --cwd c --config a.= tip -q
+hg --cwd c --config .b= tip -q
+
+echo %% --debug
+hg --cwd c log --debug
+
+echo %% --traceback
+hg --cwd c --config x --traceback tip 2>&1 | grep -i 'traceback'
+
+echo %% --time
+hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g'
+
+echo %% --version
+hg --version -q | sed 's/version [a-f0-9+]*/version xxx/'
+
+echo %% -h/--help
+hg -h
+hg --help
+
+echo %% not tested: --debugger
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-globalopts.out	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,205 @@
+adding a
+adding b
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+pulling from ../b
+searching for changes
+warning: repository is unrelated
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+%% -R/--repository
+changeset:   0:8580ff50825a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+summary:     a
+
+changeset:   0:b6c483daf290
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+summary:     b
+
+%% abbrev of long option
+changeset:   1:b6c483daf290
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+summary:     b
+
+%% --cwd
+changeset:   0:8580ff50825a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+summary:     a
+
+%% -y/--noninteractive - just be sure it is parsed
+0:8580ff50825a
+0:8580ff50825a
+%% -q/--quiet
+0:8580ff50825a
+0:b6c483daf290
+0:8580ff50825a
+1:b6c483daf290
+%% -v/--verbose
+changeset:   1:b6c483daf2907ce5825c0bb50f5716226281cc1a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       b
+description:
+b
+
+
+changeset:   0:8580ff50825a50c8f716709acdf8de0deddcd6ab
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       a
+description:
+a
+
+
+changeset:   0:b6c483daf2907ce5825c0bb50f5716226281cc1a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files:       b
+description:
+b
+
+
+%% --config
+quuxfoo
+abort: malformed --config option: 
+abort: malformed --config option: a.b
+abort: malformed --config option: a
+abort: malformed --config option: a.=
+abort: malformed --config option: .b=
+%% --debug
+changeset:   1:b6c483daf2907ce5825c0bb50f5716226281cc1a
+tag:         tip
+parent:      -1:0000000000000000000000000000000000000000
+parent:      -1:0000000000000000000000000000000000000000
+manifest:    1:23226e7a252cacdc2d99e4fbdc3653441056de49
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files+:      b
+description:
+b
+
+
+changeset:   0:8580ff50825a50c8f716709acdf8de0deddcd6ab
+parent:      -1:0000000000000000000000000000000000000000
+parent:      -1:0000000000000000000000000000000000000000
+manifest:    0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
+user:        test
+date:        Thu Jan 01 00:00:01 1970 +0000
+files+:      a
+description:
+a
+
+
+%% --traceback
+%% --time
+Time: real x.x secs (user x.x+x.x sys x.x+x.x)
+%% --version
+Mercurial Distributed SCM (version xxx)
+%% -h/--help
+Mercurial Distributed SCM
+
+list of commands (use "hg help -v" to show aliases and global options):
+
+ add        add the specified files on the next commit
+ annotate   show changeset information per file line
+ archive    create unversioned archive of a repository revision
+ backout    reverse effect of earlier changeset
+ bundle     create a changegroup file
+ cat        output the latest or given revisions of files
+ clone      make a copy of an existing repository
+ commit     commit the specified files or all outstanding changes
+ copy       mark files as copied for the next commit
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ grep       search for a pattern in specified files and revisions
+ heads      show current repository heads
+ help       show help for a given command or all commands
+ identify   print information about the working copy
+ import     import an ordered set of patches
+ incoming   show new changesets found in source
+ init       create a new repository in the given directory
+ locate     locate files matching specific patterns
+ log        show revision history of entire repository or files
+ manifest   output the latest or given revision of the project manifest
+ merge      Merge working directory with another revision
+ outgoing   show changesets not found in destination
+ parents    show the parents of the working dir or revision
+ paths      show definition of symbolic path names
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ recover    roll back an interrupted transaction
+ remove     remove the specified files on the next commit
+ rename     rename files; equivalent of copy + remove
+ revert     revert files or dirs to their states as of some revision
+ rollback   roll back the last transaction in this repository
+ root       print the root (top) of the current working dir
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ tag        add a tag for the current tip or a given revision
+ tags       list repository tags
+ tip        show the tip revision
+ unbundle   apply a changegroup file
+ update     update or merge working directory
+ verify     verify the integrity of the repository
+ version    output version and copyright information
+Mercurial Distributed SCM
+
+list of commands (use "hg help -v" to show aliases and global options):
+
+ add        add the specified files on the next commit
+ annotate   show changeset information per file line
+ archive    create unversioned archive of a repository revision
+ backout    reverse effect of earlier changeset
+ bundle     create a changegroup file
+ cat        output the latest or given revisions of files
+ clone      make a copy of an existing repository
+ commit     commit the specified files or all outstanding changes
+ copy       mark files as copied for the next commit
+ diff       diff repository (or selected files)
+ export     dump the header and diffs for one or more changesets
+ grep       search for a pattern in specified files and revisions
+ heads      show current repository heads
+ help       show help for a given command or all commands
+ identify   print information about the working copy
+ import     import an ordered set of patches
+ incoming   show new changesets found in source
+ init       create a new repository in the given directory
+ locate     locate files matching specific patterns
+ log        show revision history of entire repository or files
+ manifest   output the latest or given revision of the project manifest
+ merge      Merge working directory with another revision
+ outgoing   show changesets not found in destination
+ parents    show the parents of the working dir or revision
+ paths      show definition of symbolic path names
+ pull       pull changes from the specified source
+ push       push changes to the specified destination
+ recover    roll back an interrupted transaction
+ remove     remove the specified files on the next commit
+ rename     rename files; equivalent of copy + remove
+ revert     revert files or dirs to their states as of some revision
+ rollback   roll back the last transaction in this repository
+ root       print the root (top) of the current working dir
+ serve      export the repository via HTTP
+ status     show changed files in the working directory
+ tag        add a tag for the current tip or a given revision
+ tags       list repository tags
+ tip        show the tip revision
+ unbundle   apply a changegroup file
+ update     update or merge working directory
+ verify     verify the integrity of the repository
+ version    output version and copyright information
+%% not tested: --debugger
--- a/tests/test-hook	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-hook	Wed May 17 13:21:36 2006 -0500
@@ -29,7 +29,7 @@
 echo b > b
 hg add b
 hg commit -m b -d '1 0'
-hg update -m 1
+hg merge 1
 hg commit -m merge -d '2 0'
 
 cd ../b
@@ -61,6 +61,14 @@
 hg commit -m 'fail' -d '4 0'
 hg -q tip
 
+# preupdate hook can prevent update
+echo 'preupdate = echo preupdate hook: p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc
+hg update 1
+
+# update hook
+echo 'update = echo update hook: p1=$HG_PARENT1 p2=$HG_PARENT2 err=$HG_ERROR' >> .hg/hgrc
+hg update
+
 # prechangegroup hook can prevent incoming changes
 cd ../b
 hg -q tip
--- a/tests/test-hook.out	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-hook.out	Wed May 17 13:21:36 2006 -0500
@@ -62,6 +62,11 @@
 precommit.forbid hook
 abort: precommit.forbid hook exited with status 1
 4:4f92e785b90a
+preupdate hook: p1=b702efe9688826e3a91283852b328b84dbf37bc2 p2=
+0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+preupdate hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2=
+update hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2= err=0
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 3:4c52fb2e4022
 prechangegroup.forbid hook
 pulling from ../a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-incoming-outgoing	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+mkdir test
+cd test
+hg init
+for i in 0 1 2 3 4 5 6 7 8; do
+	echo $i >> foo
+	hg commit -A -m $i -d "1000000 0"
+done
+hg verify
+hg serve -p 20059 -d --pid-file=hg.pid
+cd ..
+
+hg init new
+# http incoming
+http_proxy= hg -R new incoming http://localhost:20059/
+# local incoming
+hg -R new incoming test
+
+# test with --bundle
+http_proxy= hg -R new incoming --bundle test.hg http://localhost:20059/
+hg -R new incoming --bundle test2.hg test
+
+# test the resulting bundles
+hg init temp
+hg init temp2
+hg -R temp unbundle test.hg
+hg -R temp2 unbundle test2.hg
+hg -R temp tip
+hg -R temp2 tip
+
+rm -rf temp temp2 new
+
+# test outgoing
+hg clone test test-dev
+cd test-dev
+for i in 9 10 11 12 13; do
+	echo $i >> foo
+	hg commit -A -m $i -d "1000000 0"
+done
+hg verify
+cd ..
+hg -R test-dev outgoing test
+http_proxy= hg -R test-dev outgoing http://localhost:20059/
+
+kill `cat test/hg.pid`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-incoming-outgoing.out	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,272 @@
+adding foo
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 9 changesets, 9 total revisions
+changeset:   0:9cb21d99fe27
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0
+
+changeset:   1:d717f5dfad6a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1
+
+changeset:   2:c0d6b86da426
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     2
+
+changeset:   3:dfacbd43b3fe
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     3
+
+changeset:   4:1f3a964b6022
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     4
+
+changeset:   5:c028bcc7a28a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     5
+
+changeset:   6:a0c0095f3389
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     6
+
+changeset:   7:d4be65f4e891
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     7
+
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+changeset:   0:9cb21d99fe27
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0
+
+changeset:   1:d717f5dfad6a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1
+
+changeset:   2:c0d6b86da426
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     2
+
+changeset:   3:dfacbd43b3fe
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     3
+
+changeset:   4:1f3a964b6022
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     4
+
+changeset:   5:c028bcc7a28a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     5
+
+changeset:   6:a0c0095f3389
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     6
+
+changeset:   7:d4be65f4e891
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     7
+
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+changeset:   0:9cb21d99fe27
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0
+
+changeset:   1:d717f5dfad6a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1
+
+changeset:   2:c0d6b86da426
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     2
+
+changeset:   3:dfacbd43b3fe
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     3
+
+changeset:   4:1f3a964b6022
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     4
+
+changeset:   5:c028bcc7a28a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     5
+
+changeset:   6:a0c0095f3389
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     6
+
+changeset:   7:d4be65f4e891
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     7
+
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+changeset:   0:9cb21d99fe27
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     0
+
+changeset:   1:d717f5dfad6a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     1
+
+changeset:   2:c0d6b86da426
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     2
+
+changeset:   3:dfacbd43b3fe
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     3
+
+changeset:   4:1f3a964b6022
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     4
+
+changeset:   5:c028bcc7a28a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     5
+
+changeset:   6:a0c0095f3389
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     6
+
+changeset:   7:d4be65f4e891
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     7
+
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+adding changesets
+adding manifests
+adding file changes
+added 9 changesets with 9 changes to 1 files
+(run 'hg update' to get a working copy)
+adding changesets
+adding manifests
+adding file changes
+added 9 changesets with 9 changes to 1 files
+(run 'hg update' to get a working copy)
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+changeset:   8:92b83e334ef8
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     8
+
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 14 changesets, 14 total revisions
+searching for changes
+changeset:   9:3741c3ad1096
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     9
+
+changeset:   10:de4143c8d9a5
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     10
+
+changeset:   11:0e1c188b9a7a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     11
+
+changeset:   12:251354d0fdd3
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     12
+
+changeset:   13:bdaadd969642
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     13
+
+searching for changes
+changeset:   9:3741c3ad1096
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     9
+
+changeset:   10:de4143c8d9a5
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     10
+
+changeset:   11:0e1c188b9a7a
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     11
+
+changeset:   12:251354d0fdd3
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     12
+
+changeset:   13:bdaadd969642
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     13
+
--- a/tests/test-merge1	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-merge1	Wed May 17 13:21:36 2006 -0500
@@ -22,7 +22,7 @@
 hg commit -m "commit #2" -d "1000000 0"
 echo This is file b1 > b
 echo %% no merges expected
-env HGMERGE=../merge hg update -m 1
+env HGMERGE=../merge hg merge 1
 cd ..; /bin/rm -rf t
 
 mkdir t
@@ -41,9 +41,9 @@
 hg commit -m "commit #2" -d "1000000 0"
 echo This is file b2 > b
 echo %% merge should fail
-env HGMERGE=../merge hg update -m 1
+env HGMERGE=../merge hg merge 1
 echo %% merge of b expected
-env HGMERGE=../merge hg update -f -m 1
+env HGMERGE=../merge hg merge -f 1
 cd ..; /bin/rm -rf t
 echo %%
 
@@ -68,9 +68,9 @@
 
 echo This is file b22 > b
 echo %% merge fails
-env HGMERGE=../merge hg update -m 2
+env HGMERGE=../merge hg merge 2
 echo %% merge expected!
-env HGMERGE=../merge hg update -f -m 2
+env HGMERGE=../merge hg merge -f 2
 cd ..; /bin/rm -rf t
 
 mkdir t
@@ -90,7 +90,7 @@
 hg commit -m "commit #3" -d "1000000 0"
 echo This is file b33 > b
 echo %% merge of b should fail
-env HGMERGE=../merge hg update -m 2
+env HGMERGE=../merge hg merge 2
 echo %% merge of b expected
-env HGMERGE=../merge hg update -f -m 2
+env HGMERGE=../merge hg merge -f 2
 cd ..; /bin/rm -rf t
--- a/tests/test-merge4	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-merge4	Wed May 17 13:21:36 2006 -0500
@@ -11,7 +11,7 @@
 echo This is file c1 > c
 hg add c
 hg commit -m "commit #2" -d "1000000 0"
-hg update -m 1
+hg merge 1
 rm b
 echo This is file c22 > c
 hg commit -m "commit #3" -d "1000000 0"
--- a/tests/test-merge6	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-merge6	Wed May 17 13:21:36 2006 -0500
@@ -33,14 +33,14 @@
 
 cd A1
 hg pull ../B1
-hg update -m
+hg merge
 hg commit -m "commit test" -d "1000000 0"
 echo bar should remain deleted.
 hg manifest
 
 cd ../B2
 hg pull ../A2
-hg update -m
+hg merge
 hg commit -m "commit test" -d "1000000 0"
 echo bar should remain deleted.
 hg manifest
--- a/tests/test-merge7	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-merge7	Wed May 17 13:21:36 2006 -0500
@@ -35,7 +35,7 @@
 
 # now pull and merge from test-a
 hg pull ../test-a
-HGMERGE=merge hg update -m
+HGMERGE=merge hg merge
 # resolve conflict
 cat >test.txt <<"EOF"
 one
@@ -57,7 +57,7 @@
 # pull and merge from test-a again
 cd ../test-b
 hg pull ../test-a
-HGMERGE=merge hg update --debug -m
+HGMERGE=merge hg merge --debug
 
 cat test.txt | sed "s% .*%%"
 
--- a/tests/test-merge7.out	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-merge7.out	Wed May 17 13:21:36 2006 -0500
@@ -22,7 +22,7 @@
 (run 'hg heads' to see heads, 'hg merge' to merge)
 merge: warning: conflicts during merge
 resolving manifests
- force None allow 1 moddirstate True linear False
+ force False allow True moddirstate True linear False
  ancestor 055d847dd401 local 2eded9ab0a5c remote 84cf5750dd20
  test.txt versions differ, resolve
 merging test.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-parseindex	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# revlog.parseindex must be able to parse the index file even if
+# an index entry is split between two 64k blocks.  The ideal test
+# would be to create an index file with inline data where
+# 64k < size < 64k + 64 (64k is the size of the read buffer, 64 is
+# the size of an index entry) and with an index entry starting right
+# before the 64k block boundary, and try to read it.
+#
+# We approximate that by reducing the read buffer to 1 byte.
+#
+
+hg init a
+cd a
+echo abc > foo
+hg add foo
+hg commit -m 'add foo' -d '1000000 0'
+
+echo >> foo
+hg commit -m 'change foo' -d '1000001 0'
+hg log -r 0:
+
+cat >> test.py << EOF
+from mercurial import changelog, util
+from mercurial.node import *
+
+class singlebyteread(object):
+    def __init__(self, real):
+        self.real = real
+
+    def read(self, size=-1):
+        if size == 65536:
+            size = 1
+        return self.real.read(size)
+
+    def __getattr__(self, key):
+        return getattr(self.real, key)
+
+def opener(*args):
+    o = util.opener(*args)
+    def wrapper(*a):
+        f = o(*a)
+        return singlebyteread(f)
+    return wrapper
+
+cl = changelog.changelog(opener('.hg'))
+print cl.count(), 'revisions:'
+for r in xrange(cl.count()):
+    print short(cl.node(r))
+EOF
+
+python test.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-parseindex.out	Wed May 17 13:21:36 2006 -0500
@@ -0,0 +1,14 @@
+changeset:   0:9c2cf2b35aa7
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     add foo
+
+changeset:   1:3756a9556b89
+tag:         tip
+user:        test
+date:        Mon Jan 12 13:46:41 1970 +0000
+summary:     change foo
+
+2 revisions:
+9c2cf2b35aa7
+3756a9556b89
--- a/tests/test-push-warn	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-push-warn	Wed May 17 13:21:36 2006 -0500
@@ -23,7 +23,7 @@
 hg push ../a
 hg pull ../a
 hg push ../a
-hg up -m
+hg merge
 hg commit -m "4" -d "1000000 0"
 hg push ../a
 cd ..
@@ -44,7 +44,7 @@
     hg ci -m d-$i -d "1000000 0"
 done
 
-HGMERGE=true hg co -m 3
+HGMERGE=true hg merge 3
 hg ci -m c-d -d "1000000 0"
 
 hg push ../c
--- a/tests/test-revert	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-revert	Wed May 17 13:21:36 2006 -0500
@@ -68,4 +68,16 @@
 echo %% should print executable
 test -x c && echo executable
 
+echo %% issue 241
+hg init a
+cd a
+echo a >> a
+hg commit -A -d '1 0' -m a
+echo a >> a
+hg commit -d '2 0' -m a
+hg update 0
+mkdir b
+echo b > b/b
+hg revert -rtip
+
 true
--- a/tests/test-revert.out	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-revert.out	Wed May 17 13:21:36 2006 -0500
@@ -51,3 +51,6 @@
 reverting c
 %% should print executable
 executable
+%% issue 241
+adding a
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-ro-message	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-ro-message	Wed May 17 13:21:36 2006 -0500
@@ -14,4 +14,4 @@
 "$HG" commit -m 'Clarifying the vehicle.'
 "$HG" update -C 1
 chmod a-w b/vehicle
-"$HG" update -m 2 2>&1 | sed 's|^\(.*[ 	]\).*/\([^/]*/[^/]*/[^/]*\)$|\1\2|g'
+"$HG" merge 2 2>&1 | sed 's|^\(.*[ 	]\).*/\([^/]*/[^/]*/[^/]*\)$|\1\2|g'
--- a/tests/test-tags	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-tags	Wed May 17 13:21:36 2006 -0500
@@ -27,7 +27,7 @@
 hg add b
 hg commit -m "branch" -d "1000000 0"
 hg id
-hg co -m 1
+hg merge 1
 hg id
 hg status
 
--- a/tests/test-up-local-change	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-up-local-change	Wed May 17 13:21:36 2006 -0500
@@ -29,7 +29,7 @@
 hg parents
 hg --debug up 0
 hg parents
-hg --debug up -m || echo failed
+hg --debug merge || echo failed
 hg parents
 hg --debug up
 hg parents
@@ -50,8 +50,8 @@
 hg status
 hg parents
 hg --debug up || echo failed
-hg --debug up -m || echo failed
-hg --debug up -f -m
+hg --debug merge || echo failed
+hg --debug merge -f
 hg parents
 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
--- a/tests/test-up-local-change.out	Wed May 10 17:05:43 2006 -0500
+++ b/tests/test-up-local-change.out	Wed May 17 13:21:36 2006 -0500
@@ -112,7 +112,7 @@
 abort: outstanding uncommitted changes
 failed
 resolving manifests
- force None allow 1 moddirstate True linear False
+ force False allow True moddirstate True linear False
  ancestor a0c8bcbbb45c local 1165e8bd193e remote 4096f2872392
  a versions differ, resolve
  b versions differ, resolve