merge with stable
authorMatt Mackall <mpm@selenic.com>
Fri, 22 Jul 2011 17:17:23 -0500
changeset 14918 ebdfdba0faaf
parent 14913 44382887d012 (current diff)
parent 14917 2957b8b1e809 (diff)
child 14921 e259375459d6
merge with stable
mercurial/commands.py
mercurial/dispatch.py
mercurial/util.py
--- a/hgext/rebase.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/hgext/rebase.py	Fri Jul 22 17:17:23 2011 -0500
@@ -180,7 +180,7 @@
                 for rev in state:
                     branches.add(repo[rev].branch())
                     if len(branches) > 1:
-                        raise util.Abort(_('cannot collapse multiple named ' 
+                        raise util.Abort(_('cannot collapse multiple named '
                             'branches'))
 
 
--- a/mercurial/commands.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/mercurial/commands.py	Fri Jul 22 17:17:23 2011 -0500
@@ -4156,9 +4156,11 @@
        To cancel a merge (and lose your changes), use :hg:`update --clean .`.
 
     With no revision specified, revert the specified files or directories
-    to the state they had in the first parent of the working directory.
+    to the contents they had in the parent of the working directory.
     This restores the contents of files to an unmodified
-    state and unschedules adds, removes, copies, and renames.
+    state and unschedules adds, removes, copies, and renames. If the
+    working directory has two parents, you must explicitly specify a
+    revision.
 
     Using the -r/--rev or -d/--date options, revert the given files or
     directories to their states as of a specific revision. Because
@@ -4181,6 +4183,11 @@
         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
 
     parent, p2 = repo.dirstate.parents()
+    if not opts.get('rev') and p2 != nullid:
+        # revert after merge is a trap for new users (issue2915)
+        raise util.Abort(_('uncommitted merge with no revision specified'),
+                         hint=_('use "hg update" or see "hg help revert"'))
+
     ctx = scmutil.revsingle(repo, opts.get('rev'))
     node = ctx.node()
 
--- a/mercurial/dispatch.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/mercurial/dispatch.py	Fri Jul 22 17:17:23 2011 -0500
@@ -651,7 +651,7 @@
                             req.args = ['--repository', guess] + fullargs
                             return _dispatch(req)
                     if not path:
-                        raise error.RepoError(_("no repository found in %r"
+                        raise error.RepoError(_("no repository found in '%s'"
                                                 " (.hg not found)") % os.getcwd())
                     raise
         if repo:
--- a/mercurial/hook.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/mercurial/hook.py	Fri Jul 22 17:17:23 2011 -0500
@@ -65,26 +65,27 @@
                                '("%s" is not callable)') %
                              (hname, funcname))
     try:
-        # redirect IO descriptors the the ui descriptors so hooks that write
-        # directly to these don't mess the command protocol when running through
-        # the command server
-        old = sys.stdout, sys.stderr, sys.stdin
-        sys.stdout, sys.stderr, sys.stdin = ui.fout, ui.ferr, ui.fin
+        try:
+            # redirect IO descriptors the the ui descriptors so hooks
+            # that write directly to these don't mess up the command
+            # protocol when running through the command server
+            old = sys.stdout, sys.stderr, sys.stdin
+            sys.stdout, sys.stderr, sys.stdin = ui.fout, ui.ferr, ui.fin
 
-        r = obj(ui=ui, repo=repo, hooktype=name, **args)
-    except KeyboardInterrupt:
-        raise
-    except Exception, exc:
-        if isinstance(exc, util.Abort):
-            ui.warn(_('error: %s hook failed: %s\n') %
-                         (hname, exc.args[0]))
-        else:
-            ui.warn(_('error: %s hook raised an exception: '
-                           '%s\n') % (hname, exc))
-        if throw:
+            r = obj(ui=ui, repo=repo, hooktype=name, **args)
+        except KeyboardInterrupt:
             raise
-        ui.traceback()
-        return True
+        except Exception, exc:
+            if isinstance(exc, util.Abort):
+                ui.warn(_('error: %s hook failed: %s\n') %
+                             (hname, exc.args[0]))
+            else:
+                ui.warn(_('error: %s hook raised an exception: '
+                               '%s\n') % (hname, exc))
+            if throw:
+                raise
+            ui.traceback()
+            return True
     finally:
         sys.stdout, sys.stderr, sys.stdin = old
     if r:
--- a/mercurial/util.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/mercurial/util.py	Fri Jul 22 17:17:23 2011 -0500
@@ -1332,6 +1332,8 @@
     <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
     >>> url('file:///home/joe/repo')
     <url scheme: 'file', path: '/home/joe/repo'>
+    >>> url('file:///c:/temp/foo/')
+    <url scheme: 'file', path: 'c:/temp/foo/'>
     >>> url('bundle:foo')
     <url scheme: 'bundle', path: 'foo'>
     >>> url('bundle://../foo')
@@ -1421,7 +1423,7 @@
                     path = None
                 if not self.host:
                     self.host = None
-                    if path:
+                    if path and not hasdriveletter(path):
                         path = '/' + path
 
             if self.host and '@' in self.host:
--- a/tests/test-confused-revert.t	Thu Jul 21 15:10:16 2011 +0200
+++ b/tests/test-confused-revert.t	Fri Jul 22 17:17:23 2011 -0500
@@ -59,8 +59,8 @@
 Revert should fail:
 
   $ hg revert
-  abort: no files or directories specified
-  (uncommitted merge, use --all to discard all changes, or 'hg update -C .' to abort the merge)
+  abort: uncommitted merge with no revision specified
+  (use "hg update" or see "hg help revert")
   [255]
 
 Revert should be ok now:
--- a/tests/test-i18n.t	Thu Jul 21 15:10:16 2011 +0200
+++ b/tests/test-i18n.t	Fri Jul 22 17:17:23 2011 -0500
@@ -8,17 +8,17 @@
 using the "replace" error handler:
 
   $ LANGUAGE=pt_BR hg tip
-  abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
+  abortado: no repository found in '$TESTTMP' (.hg not found)!
   [255]
 
 Using a more accomodating encoding:
 
   $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
-  abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
+  abortado: no repository found in '$TESTTMP' (.hg not found)!
   [255]
 
 Different encoding:
 
   $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
-  abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
+  abortado: no repository found in '$TESTTMP' (.hg not found)!
   [255]