--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/casesmash.py Fri Jun 24 13:35:44 2011 -0500
@@ -0,0 +1,34 @@
+import sys, os, __builtin__
+from mercurial import util
+
+def lowerwrap(scope, funcname):
+ f = getattr(scope, funcname)
+ def wrap(fname, *args, **kwargs):
+ d, base = os.path.split(fname)
+ try:
+ files = os.listdir(d or '.')
+ except OSError, inst:
+ files = []
+ if base in files:
+ return f(fname, *args, **kwargs)
+ for fn in files:
+ if fn.lower() == base.lower():
+ return f(os.path.join(d, fn), *args, **kwargs)
+ return f(fname, *args, **kwargs)
+ scope.__dict__[funcname] = wrap
+
+def normcase(path):
+ return path.lower()
+
+os.path.normcase = normcase
+
+for f in 'file open'.split():
+ lowerwrap(__builtin__, f)
+
+for f in "chmod chown open lstat stat remove unlink".split():
+ lowerwrap(os, f)
+
+for f in "exists lexists".split():
+ lowerwrap(os.path, f)
+
+lowerwrap(util, 'posixfile')
--- a/mercurial/commands.py Fri Jun 24 00:21:00 2011 -0500
+++ b/mercurial/commands.py Fri Jun 24 13:35:44 2011 -0500
@@ -4179,6 +4179,8 @@
opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
parent, p2 = repo.dirstate.parents()
+ ctx = scmutil.revsingle(repo, opts.get('rev'))
+ node = ctx.node()
if not pats and not opts.get('all'):
msg = _("no files or directories specified")
@@ -4186,10 +4188,15 @@
if p2 != nullid:
hint = _("uncommitted merge, use --all to discard all changes,"
" or 'hg update -C .' to abort the merge")
+ elif node != parent:
+ if util.any(repo.status()):
+ hint = _("uncommitted changes, use --all to discard all"
+ " changes, or 'hg update %s' to update") % ctx.rev()
+ else:
+ hint = _("use --all to revert all files,"
+ " or 'hg update %s' to update") % ctx.rev()
raise util.Abort(msg, hint=hint)
- ctx = scmutil.revsingle(repo, opts.get('rev'))
- node = ctx.node()
mf = ctx.manifest()
if node == parent:
pmf = mf
@@ -5051,6 +5058,9 @@
found, the working directory is updated to the specified
changeset.
+ Update sets the working directory's parent revison to the specified
+ changeset (see :hg:`help parents`).
+
The following rules apply when the working directory contains
uncommitted changes:
@@ -5072,8 +5082,8 @@
Use null as the changeset to remove the working directory (like
:hg:`clone -U`).
- If you want to update just one file to an older changeset, use
- :hg:`revert`.
+ If you want to revert just one file to an older revision, use
+ :hg:`revert [-r REV] NAME`.
See :hg:`help dates` for a list of formats valid for -d/--date.
--- a/mercurial/commandserver.py Fri Jun 24 00:21:00 2011 -0500
+++ b/mercurial/commandserver.py Fri Jun 24 13:35:44 2011 -0500
@@ -73,8 +73,8 @@
s = self._read(size, self.channel)
buf = s
while s:
+ s = self._read(size, self.channel)
buf += s
- s = self._read(size, self.channel)
return buf
else:
@@ -104,8 +104,8 @@
# keep asking for more until there's either no more or
# we got a full line
while s and s[-1] != '\n':
+ s = self._read(size, 'L')
buf += s
- s = self._read(size, 'L')
return buf
else:
--- a/mercurial/dispatch.py Fri Jun 24 00:21:00 2011 -0500
+++ b/mercurial/dispatch.py Fri Jun 24 13:35:44 2011 -0500
@@ -654,7 +654,7 @@
return runcommand(lui, repo, cmd, fullargs, ui, options, d,
cmdpats, cmdoptions)
finally:
- if repo != req.repo:
+ if repo and repo != req.repo:
repo.close()
def _runcommand(ui, options, cmd, cmdfunc):
--- a/tests/test-revert.t Fri Jun 24 00:21:00 2011 -0500
+++ b/tests/test-revert.t Fri Jun 24 13:35:44 2011 -0500
@@ -186,7 +186,7 @@
$ hg revert -rtip
abort: no files or directories specified
- (use --all to discard all changes)
+ (use --all to revert all files, or 'hg update 1' to update)
[255]
should succeed