changeset 4016:a195f11ed1a2

sync with -stable
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 02 Jan 2007 22:40:52 +0100
parents 20da40cc1c73 (current diff) 769be3c57564 (diff)
children ea6174c96ae1
files hgext/mq.py mercurial/commands.py mercurial/hgweb/server.py mercurial/httprepo.py
diffstat 10 files changed, 80 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Fri Dec 29 20:04:31 2006 -0600
+++ b/doc/hgrc.5.txt	Tue Jan 02 22:40:52 2007 +0100
@@ -151,6 +151,22 @@
   defining command defaults. The command defaults will also be
   applied to the aliases of the commands defined.
 
+diff::
+  Settings used when displaying diffs. They are all boolean and
+  defaults to False.
+  git;;
+    Use git extended diff format.
+  nodates;;
+    Don't include dates in diff headers.
+  showfunc;;
+    Show which function each change is in.
+  ignorews;;
+    Ignore white space when comparing lines.
+  ignorewsamount;;
+    Ignore changes in the amount of white space.
+  ignoreblanklines;;
+    Ignore changes whose lines are all blank.
+
 email::
   Settings for extensions that send email messages.
   from;;
--- a/hgext/mq.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/hgext/mq.py	Tue Jan 02 22:40:52 2007 +0100
@@ -698,7 +698,6 @@
         if saveheads:
             backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip')
             chgrpfile = bundle(backupch)
-            chgrpfile = 'file:%s' % chgrpfile
 
         stripall(revnum)
 
@@ -707,7 +706,8 @@
         repo.manifest.strip(repo.manifest.rev(change[0]), revnum)
         if saveheads:
             self.ui.status("adding branch\n")
-            commands.unbundle(self.ui, repo, chgrpfile, update=False)
+            commands.unbundle(self.ui, repo, "file:%s" % chgrpfile,
+                              update=False)
             if backup != "strip":
                 os.unlink(chgrpfile)
 
--- a/mercurial/commands.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/commands.py	Tue Jan 02 22:40:52 2007 +0100
@@ -11,7 +11,7 @@
 import bisect, os, re, sys, signal, imp, urllib, pdb, shlex, stat
 import fancyopts, ui, hg, util, lock, revlog, bundlerepo
 import difflib, patch, time, help, mdiff, tempfile
-import traceback, errno, version, atexit
+import traceback, errno, version, atexit, socket
 import archival, changegroup, cmdutil, hgweb.server, sshserver
 
 class UnknownCommand(Exception):
@@ -1337,13 +1337,20 @@
             ui.write(d, '\n')
 
         ui.status('\n')
+
+        try:
+            ct = mod.cmdtable
+        except AttributeError:
+            ui.status(_('no commands defined\n'))
+            return
+
         if ui.verbose:
             ui.status(_('list of commands:\n\n'))
         else:
             ui.status(_('list of commands (use "hg help -v %s" '
                         'to show aliases and global options):\n\n') % name)
 
-        modcmds = dict.fromkeys([c.split('|', 1)[0] for c in mod.cmdtable])
+        modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
         helplist(modcmds.has_key)
 
     if name and name != 'shortlist':
@@ -1761,7 +1768,7 @@
         ui.write("%s\n" % f)
 
 def merge(ui, repo, node=None, force=None):
-    """Merge working directory with another revision
+    """merge working directory with another revision
 
     Merge the contents of the current working directory and the
     requested revision. Files that changed between either parent are
@@ -2477,7 +2484,7 @@
     return postincoming(ui, repo, modheads, opts['update'])
 
 def update(ui, repo, node=None, clean=False, date=None):
-    """update or merge working directory
+    """update working directory
 
     Update the working directory to the specified revision.
 
@@ -2489,7 +2496,7 @@
     merge command.
 
     By default, update will refuse to run if doing so would require
-    merging or discarding local changes.
+    discarding local changes.
     """
     if date:
         if node:
@@ -2768,7 +2775,7 @@
          ] + walkopts,
          _('hg log [OPTION]... [FILE]')),
     "manifest": (manifest, [], _('hg manifest [REV]')),
-    "merge":
+    "^merge":
         (merge,
          [('f', 'force', None, _('force a merge with outstanding changes'))],
          _('hg merge [-f] [REV]')),
@@ -3230,11 +3237,17 @@
                     u.warn(_("\nbroken pipe\n"))
             else:
                 raise
+    except socket.error, inst:
+        u.warn(_("abort: %s\n") % inst[1])
     except IOError, inst:
         if hasattr(inst, "code"):
             u.warn(_("abort: %s\n") % inst)
         elif hasattr(inst, "reason"):
-            u.warn(_("abort: error: %s\n") % inst.reason[1])
+            try: # usually it is in the form (errno, strerror)
+                reason = inst.reason.args[1]
+            except: # it might be anything, for example a string
+                reason = inst.reason
+            u.warn(_("abort: error: %s\n") % reason)
         elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
             if u.debugflag:
                 u.warn(_("broken pipe\n"))
--- a/mercurial/hgweb/server.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/hgweb/server.py	Tue Jan 02 22:40:52 2007 +0100
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer
+import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback
 from mercurial import ui, hg, util, templater
 from hgweb_mod import hgweb
 from hgwebdir_mod import hgwebdir
@@ -55,10 +55,17 @@
 
     def do_POST(self):
         try:
-            self.do_hgweb()
-        except socket.error, inst:
-            if inst[0] != errno.EPIPE:
-                raise
+            try:
+                self.do_hgweb()
+            except socket.error, inst:
+                if inst[0] != errno.EPIPE:
+                    raise
+        except StandardError, inst:
+            self._start_response("500 Internal Server Error", [])
+            self._write("Internal Server Error")
+            tb = "".join(traceback.format_exception(*sys.exc_info()))
+            self.log_error("Exception happened during processing request '%s':\n%s",
+                           self.path, tb)
 
     def do_GET(self):
         self.do_POST()
--- a/mercurial/httprepo.py	Fri Dec 29 20:04:31 2006 -0600
+++ b/mercurial/httprepo.py	Tue Jan 02 22:40:52 2007 +0100
@@ -256,15 +256,19 @@
             proto = resp.headers['content-type']
 
         # accept old "text/plain" and "application/hg-changegroup" for now
-        if not proto.startswith('application/mercurial') and \
+        if not proto.startswith('application/mercurial-') and \
                not proto.startswith('text/plain') and \
                not proto.startswith('application/hg-changegroup'):
             raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
                                self._url)
 
-        if proto.startswith('application/mercurial'):
-            version = proto[22:]
-            if float(version) > 0.1:
+        if proto.startswith('application/mercurial-'):
+            try:
+                version = float(proto[22:])
+            except ValueError:
+                raise hg.RepoError(_("'%s' sent a broken Content-type "
+                                     "header (%s)") % (self._url, proto))
+            if version > 0.1:
                 raise hg.RepoError(_("'%s' uses newer protocol %s") %
                                    (self._url, version))
 
--- a/tests/test-globalopts.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-globalopts.out	Tue Jan 02 22:40:52 2007 +0100
@@ -141,7 +141,7 @@
  locate       locate files matching specific patterns
  log          show revision history of entire repository or files
  manifest     output the current or given revision of the project manifest
- merge        Merge working directory with another revision
+ 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
@@ -160,7 +160,7 @@
  tags         list repository tags
  tip          show the tip revision
  unbundle     apply a changegroup file
- update       update or merge working directory
+ update       update working directory
  verify       verify the integrity of the repository
  version      output version and copyright information
 Mercurial Distributed SCM
@@ -191,7 +191,7 @@
  locate       locate files matching specific patterns
  log          show revision history of entire repository or files
  manifest     output the current or given revision of the project manifest
- merge        Merge working directory with another revision
+ 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
@@ -210,7 +210,7 @@
  tags         list repository tags
  tip          show the tip revision
  unbundle     apply a changegroup file
- update       update or merge working directory
+ update       update working directory
  verify       verify the integrity of the repository
  version      output version and copyright information
 %% not tested: --debugger
--- a/tests/test-help.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-help.out	Tue Jan 02 22:40:52 2007 +0100
@@ -10,6 +10,7 @@
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
+ merge      merge working directory with another revision
  parents    show the parents of the working dir or revision
  pull       pull changes from the specified source
  push       push changes to the specified destination
@@ -17,7 +18,7 @@
  revert     revert files or dirs to their states as of some revision
  serve      export the repository via HTTP
  status     show changed files in the working directory
- update     update or merge working directory
+ update     update working directory
  add        add the specified files on the next commit
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
@@ -26,6 +27,7 @@
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
+ merge      merge working directory with another revision
  parents    show the parents of the working dir or revision
  pull       pull changes from the specified source
  push       push changes to the specified destination
@@ -33,7 +35,7 @@
  revert     revert files or dirs to their states as of some revision
  serve      export the repository via HTTP
  status     show changed files in the working directory
- update     update or merge working directory
+ update     update working directory
 Mercurial Distributed SCM
 
 list of commands (use "hg help -v" to show aliases and global options):
@@ -62,7 +64,7 @@
  locate       locate files matching specific patterns
  log          show revision history of entire repository or files
  manifest     output the current or given revision of the project manifest
- merge        Merge working directory with another revision
+ 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
@@ -81,7 +83,7 @@
  tags         list repository tags
  tip          show the tip revision
  unbundle     apply a changegroup file
- update       update or merge working directory
+ update       update working directory
  verify       verify the integrity of the repository
  version      output version and copyright information
  add          add the specified files on the next commit
@@ -108,7 +110,7 @@
  locate       locate files matching specific patterns
  log          show revision history of entire repository or files
  manifest     output the current or given revision of the project manifest
- merge        Merge working directory with another revision
+ 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
@@ -127,7 +129,7 @@
  tags         list repository tags
  tip          show the tip revision
  unbundle     apply a changegroup file
- update       update or merge working directory
+ update       update working directory
  verify       verify the integrity of the repository
  version      output version and copyright information
 hg add [OPTION]... [FILE]...
@@ -257,6 +259,7 @@
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
+ merge      merge working directory with another revision
  parents    show the parents of the working dir or revision
  pull       pull changes from the specified source
  push       push changes to the specified destination
@@ -264,7 +267,7 @@
  revert     revert files or dirs to their states as of some revision
  serve      export the repository via HTTP
  status     show changed files in the working directory
- update     update or merge working directory
+ update     update working directory
 hg: unknown command 'skjdfks'
 Mercurial Distributed SCM
 
@@ -278,6 +281,7 @@
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
+ merge      merge working directory with another revision
  parents    show the parents of the working dir or revision
  pull       pull changes from the specified source
  push       push changes to the specified destination
@@ -285,4 +289,4 @@
  revert     revert files or dirs to their states as of some revision
  serve      export the repository via HTTP
  status     show changed files in the working directory
- update     update or merge working directory
+ update     update working directory
--- a/tests/test-notify	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-notify	Tue Jan 02 22:40:52 2007 +0100
@@ -22,6 +22,7 @@
 foo@bar = *
 EOF
 
+hg help notify
 hg init a
 echo a > a/a
 echo % commit
--- a/tests/test-notify.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-notify.out	Tue Jan 02 22:40:52 2007 +0100
@@ -1,3 +1,6 @@
+notify extension - No help text available
+
+no commands defined
 % commit
 adding a
 % clone
--- a/tests/test-strict.out	Fri Dec 29 20:04:31 2006 -0600
+++ b/tests/test-strict.out	Tue Jan 02 22:40:52 2007 +0100
@@ -13,6 +13,7 @@
  export     dump the header and diffs for one or more changesets
  init       create a new repository in the given directory
  log        show revision history of entire repository or files
+ merge      merge working directory with another revision
  parents    show the parents of the working dir or revision
  pull       pull changes from the specified source
  push       push changes to the specified destination
@@ -20,7 +21,7 @@
  revert     revert files or dirs to their states as of some revision
  serve      export the repository via HTTP
  status     show changed files in the working directory
- update     update or merge working directory
+ update     update working directory
 0: a
 % should succeed - up is an alias, not an abbreviation
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved