changeset 10169:e78a62551586

Merge with i18n.
author Martin Geisler <mg@lazybytes.net>
date Wed, 30 Dec 2009 20:37:53 +0100
parents df7fc77533fb (diff) b9d597882ba9 (current diff)
children 910196cdfa9c
files
diffstat 63 files changed, 593 insertions(+), 137 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Dec 30 03:39:34 2009 +0100
+++ b/Makefile	Wed Dec 30 20:37:53 2009 +0100
@@ -1,3 +1,9 @@
+# If you want to change PREFIX, do not just edit it below. The changed
+# value wont get passed on to recursive make calls. You should instead
+# override the variable on the command like:
+#
+# % make PREFIX=/opt/ install
+
 PREFIX=/usr/local
 export PREFIX
 PYTHON=python
--- a/doc/hgrc.5.txt	Wed Dec 30 03:39:34 2009 +0100
+++ b/doc/hgrc.5.txt	Wed Dec 30 20:37:53 2009 +0100
@@ -646,12 +646,13 @@
 
 ``eol``
     When set to 'strict' patch content and patched files end of lines
-    are preserved. When set to ``lf`` or ``crlf``, both files end of lines
-    are ignored when patching and the result line endings are
+    are preserved. When set to ``lf`` or ``crlf``, both files end of
+    lines are ignored when patching and the result line endings are
     normalized to either LF (Unix) or CRLF (Windows). When set to
     ``auto``, end of lines are again ignored while patching but line
     endings in patched files are normalized to their original setting
-    on a per-file basis.
+    on a per-file basis. If target file does not exist or has no end
+    of line, patch line endings are preserved.
     Default: strict.
 
 
--- a/hgext/acl.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/acl.py	Wed Dec 30 20:37:53 2009 +0100
@@ -25,7 +25,7 @@
 To use this hook, configure the acl extension in your hgrc like this::
 
   [extensions]
-  hgext.acl =
+  acl =
 
   [hooks]
   pretxnchangegroup.acl = python:hgext.acl.hook
--- a/hgext/bugzilla.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/bugzilla.py	Wed Dec 30 20:37:53 2009 +0100
@@ -103,7 +103,7 @@
 Activating the extension::
 
     [extensions]
-    hgext.bugzilla =
+    bugzilla =
 
     [hooks]
     # run bugzilla hook on every change pulled or pushed in here
--- a/hgext/children.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/children.py	Wed Dec 30 20:37:53 2009 +0100
@@ -33,7 +33,7 @@
     displayer = cmdutil.show_changeset(ui, repo, opts)
     for cctx in ctx.children():
         displayer.show(cctx)
-
+    displayer.close()
 
 cmdtable = {
     "children":
--- a/hgext/keyword.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/keyword.py	Wed Dec 30 20:37:53 2009 +0100
@@ -93,7 +93,8 @@
 
 # hg commands that trigger expansion only when writing to working dir,
 # not when reading filelog, and unexpand when reading from working dir
-restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord'
+restricted = ('merge record resolve qfold qimport qnew qpush qrefresh qrecord'
+              ' transplant')
 
 # provide cvs-like UTC date filter
 utcdate = lambda x: util.datestr(x, '%Y/%m/%d %H:%M:%S')
@@ -537,7 +538,8 @@
     repo.__class__ = kwrepo
 
     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
-    extensions.wrapfunction(patch, 'diff', kw_diff)
+    if not kwt.restrict:
+        extensions.wrapfunction(patch, 'diff', kw_diff)
     for c in 'annotate changeset rev filediff diff'.split():
         extensions.wrapfunction(webcommands, c, kwweb_skip)
 
--- a/hgext/mq.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/mq.py	Wed Dec 30 20:37:53 2009 +0100
@@ -770,6 +770,10 @@
         else:
             m, a, r, d = self.check_localchanges(repo, force)
             match = cmdutil.matchfiles(repo, m + a + r)
+        if force:
+            p = repo[None].parents()
+            if len(p) > 1:
+                raise util.Abort(_('cannot manage merge changesets'))
         commitfiles = m + a + r
         self.check_toppatch(repo)
         insert = self.full_series_end()
@@ -1155,15 +1159,6 @@
             cparents = repo.changelog.parents(top)
             patchparent = self.qparents(repo, top)
             ph = patchheader(self.join(patchfn))
-
-            patchf = self.opener(patchfn, 'r')
-
-            # if the patch was a git patch, refresh it as a git patch
-            for line in patchf:
-                if line.startswith('diff --git'):
-                    self.diffopts().git = True
-                    break
-
             if msg:
                 ph.setmessage(msg)
             if newuser:
@@ -1171,12 +1166,17 @@
             if newdate:
                 ph.setdate(newdate)
 
+            # if the patch was a git patch, refresh it as a git patch
+            patchf = self.opener(patchfn, 'r')
+            for line in patchf:
+                if line.startswith('diff --git'):
+                    self.diffopts().git = True
+                    break
+            patchf.close()
+
             # only commit new patch when write is complete
             patchf = self.opener(patchfn, 'w', atomictemp=True)
 
-            patchf.seek(0)
-            patchf.truncate()
-
             comments = str(ph)
             if comments:
                 patchf.write(comments)
--- a/hgext/notify.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/notify.py	Wed Dec 30 20:37:53 2009 +0100
@@ -14,7 +14,7 @@
 this::
 
   [extensions]
-  hgext.notify =
+  notify =
 
   [hooks]
   # one email for each incoming changeset
--- a/hgext/pager.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/pager.py	Wed Dec 30 20:37:53 2009 +0100
@@ -8,7 +8,7 @@
 # To load the extension, add it to your .hgrc file:
 #
 #   [extension]
-#   hgext.pager =
+#   pager =
 #
 # Run "hg help pager" to get info on configuration.
 
--- a/hgext/transplant.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/transplant.py	Wed Dec 30 20:37:53 2009 +0100
@@ -430,6 +430,7 @@
             transplants = ()
             merges = ()
             break
+    displayer.close()
     return (transplants, merges)
 
 def transplant(ui, repo, *revs, **opts):
--- a/hgext/win32text.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/hgext/win32text.py	Wed Dec 30 20:37:53 2009 +0100
@@ -10,7 +10,7 @@
 To perform automatic newline conversion, use::
 
   [extensions]
-  hgext.win32text =
+  win32text =
   [encode]
   ** = cleverencode:
   # or ** = macencode:
@@ -137,7 +137,7 @@
                   'and also consider adding:\n'
                   '\n'
                   '[extensions]\n'
-                  'hgext.win32text =\n'
+                  'win32text =\n'
                   '[encode]\n'
                   '** = %sencode:\n'
                   '[decode]\n'
--- a/mercurial/cmdutil.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/cmdutil.py	Wed Dec 30 20:37:53 2009 +0100
@@ -637,6 +637,7 @@
         self.header = {}
         self.hunk = {}
         self.lastheader = None
+        self.footer = None
 
     def flush(self, rev):
         if rev in self.header:
@@ -651,6 +652,10 @@
             return 1
         return 0
 
+    def close(self):
+        if self.footer:
+            self.ui.write(self.footer)
+
     def show(self, ctx, copies=None, **props):
         if self.buffered:
             self.ui.pushbuffer()
@@ -817,7 +822,7 @@
             (self.ui.debugflag, 'debug'),
         ]
 
-        types = {'header': '', 'changeset': 'changeset'}
+        types = {'header': '', 'footer':'', 'changeset': 'changeset'}
         for mode, postfix  in tmplmodes:
             for type in types:
                 cur = postfix and ('%s_%s' % (type, postfix)) or type
@@ -839,6 +844,11 @@
             self.ui.write(templater.stringify(self.t(key, **props)))
             self.showpatch(ctx.node())
 
+            if types['header']:
+                if not self.footer:
+                    self.footer = templater.stringify(self.t(types['footer'],
+                                                      **props))
+
         except KeyError, inst:
             msg = _("%s: no key named '%s'")
             raise util.Abort(msg % (self.t.mapfile, inst.args[0]))
--- a/mercurial/commands.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/commands.py	Wed Dec 30 20:37:53 2009 +0100
@@ -306,6 +306,7 @@
                         "bad revision could be any of:\n"))
             for n in nodes:
                 displayer.show(repo[n])
+        displayer.close()
 
     def check_state(state, interactive=True):
         if not state['good'] or not state['bad']:
@@ -1443,6 +1444,7 @@
     displayer = cmdutil.show_changeset(ui, repo, opts)
     for n in heads:
         displayer.show(repo[n])
+    displayer.close()
 
 def help_(ui, name=None, with_version=False):
     """show help for a given topic or a help overview
@@ -1931,6 +1933,7 @@
                 continue
             count += 1
             displayer.show(other[n])
+        displayer.close()
     finally:
         if hasattr(other, 'close'):
             other.close()
@@ -2066,6 +2069,7 @@
             break
         if displayer.flush(ctx.rev()):
             count += 1
+    displayer.close()
 
 def manifest(ui, repo, node=None, rev=None):
     """output the current or given revision of the project manifest
@@ -2148,6 +2152,7 @@
         for node in repo.changelog.nodesbetween(roots=roots, heads=heads)[0]:
             if node not in roots:
                 displayer.show(repo[node])
+        displayer.close()
         return 0
 
     return hg.merge(repo, node, force=opts.get('force'))
@@ -2186,6 +2191,7 @@
             continue
         count += 1
         displayer.show(repo[n])
+    displayer.close()
 
 def parents(ui, repo, file_=None, **opts):
     """show the parents of the working directory or revision
@@ -2226,6 +2232,7 @@
     for n in p:
         if n != nullid:
             displayer.show(repo[n])
+    displayer.close()
 
 def paths(ui, repo, search=None):
     """show aliases for remote repositories
@@ -3106,7 +3113,9 @@
     that repository becomes the current tip. The "tip" tag is special
     and cannot be renamed or assigned to a different changeset.
     """
-    cmdutil.show_changeset(ui, repo, opts).show(repo[len(repo) - 1])
+    displayer = cmdutil.show_changeset(ui, repo, opts)
+    displayer.show(repo[len(repo) - 1])
+    displayer.close()
 
 def unbundle(ui, repo, fname1, *fnames, **opts):
     """apply one or more changegroup files
--- a/mercurial/diffhelpers.c	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/diffhelpers.c	Wed Dec 30 20:37:53 2009 +0100
@@ -21,12 +21,17 @@
 	int hunksz = PyList_Size(hunk);
 	PyObject *s = PyList_GET_ITEM(hunk, hunksz-1);
 	char *l = PyString_AS_STRING(s);
-	int sz = PyString_GET_SIZE(s);
 	int alen = PyList_Size(a);
 	int blen = PyList_Size(b);
 	char c = l[0];
+	PyObject *hline;
+	int sz = PyString_GET_SIZE(s);
 
-	PyObject *hline = PyString_FromStringAndSize(l, sz-1);
+	if (sz > 1 && l[sz-2] == '\r')
+		/* tolerate CRLF in last line */
+		sz -= 1;
+	hline = PyString_FromStringAndSize(l, sz-1);
+
 	if (c == ' ' || c == '+') {
 		PyObject *rline = PyString_FromStringAndSize(l+1, sz-2);
 		PyList_SetItem(b, blen-1, rline);
--- a/mercurial/dirstate.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/dirstate.py	Wed Dec 30 20:37:53 2009 +0100
@@ -38,9 +38,12 @@
 class dirstate(object):
 
     def __init__(self, opener, ui, root):
-        '''Create a new dirstate object.  opener is an open()-like callable
-        that can be used to open the dirstate file; root is the root of the
-        directory tracked by the dirstate.'''
+        '''Create a new dirstate object.
+
+        opener is an open()-like callable that can be used to open the
+        dirstate file; root is the root of the directory tracked by
+        the dirstate.
+        '''
         self._opener = opener
         self._root = root
         self._rootdir = os.path.join(root, '')
@@ -175,6 +178,7 @@
 
     def __getitem__(self, key):
         '''Return the current state of key (a filename) in the dirstate.
+
         States are:
           n  normal
           m  needs merging
@@ -227,8 +231,7 @@
         self._dirty = False
 
     def copy(self, source, dest):
-        """Mark dest as a copy of source. Unmark dest if source is None.
-        """
+        """Mark dest as a copy of source. Unmark dest if source is None."""
         if source == dest:
             return
         self._dirty = True
@@ -266,7 +269,7 @@
             _incdirs(self._dirs, f)
 
     def normal(self, f):
-        'mark a file normal and clean'
+        '''Mark a file normal and clean.'''
         self._dirty = True
         self._addpath(f)
         s = os.lstat(self._join(f))
@@ -275,7 +278,7 @@
             del self._copymap[f]
 
     def normallookup(self, f):
-        'mark a file normal, but possibly dirty'
+        '''Mark a file normal, but possibly dirty.'''
         if self._pl[1] != nullid and f in self._map:
             # if there is a merge going on and the file was either
             # in state 'm' or dirty before being removed, restore that state.
@@ -298,7 +301,7 @@
             del self._copymap[f]
 
     def normaldirty(self, f):
-        'mark a file normal, but dirty'
+        '''Mark a file normal, but dirty.'''
         self._dirty = True
         self._addpath(f)
         self._map[f] = ('n', 0, -2, -1)
@@ -306,7 +309,7 @@
             del self._copymap[f]
 
     def add(self, f):
-        'mark a file added'
+        '''Mark a file added.'''
         self._dirty = True
         self._addpath(f, True)
         self._map[f] = ('a', 0, -1, -1)
@@ -314,7 +317,7 @@
             del self._copymap[f]
 
     def remove(self, f):
-        'mark a file removed'
+        '''Mark a file removed.'''
         self._dirty = True
         self._droppath(f)
         size = 0
@@ -329,7 +332,7 @@
             del self._copymap[f]
 
     def merge(self, f):
-        'mark a file merged'
+        '''Mark a file merged.'''
         self._dirty = True
         s = os.lstat(self._join(f))
         self._addpath(f)
@@ -338,7 +341,7 @@
             del self._copymap[f]
 
     def forget(self, f):
-        'forget a file'
+        '''Forget a file.'''
         self._dirty = True
         try:
             self._droppath(f)
--- a/mercurial/help/extensions.txt	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/help/extensions.txt	Wed Dec 30 20:37:53 2009 +0100
@@ -28,6 +28,6 @@
 
   [extensions]
   # disabling extension bar residing in /path/to/extension/bar.py
-  hgext.bar = !/path/to/extension/bar.py
+  bar = !/path/to/extension/bar.py
   # ditto, but no path was supplied for extension baz
-  hgext.baz = !
+  baz = !
--- a/mercurial/patch.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/patch.py	Wed Dec 30 20:37:53 2009 +0100
@@ -294,6 +294,7 @@
         self.hash = {}
         self.dirty = 0
         self.offset = 0
+        self.skew = 0
         self.rej = []
         self.fileprinted = False
         self.printfile(False)
@@ -321,14 +322,14 @@
         else:
             fp = self.opener(fname, 'w')
         try:
-            if self.eolmode == 'auto' and self.eol:
+            if self.eolmode == 'auto':
                 eol = self.eol
             elif self.eolmode == 'crlf':
                 eol = '\r\n'
             else:
                 eol = '\n'
 
-            if self.eolmode != 'strict' and eol != '\n':
+            if self.eolmode != 'strict' and eol and eol != '\n':
                 for l in lines:
                     if l and l[-1] == '\n':
                         l = l[:-1] + eol
@@ -433,6 +434,14 @@
                 self.dirty = 1
             return 0
 
+        horig = h
+        if (self.eolmode in ('crlf', 'lf')
+            or self.eolmode == 'auto' and self.eol):
+            # If new eols are going to be normalized, then normalize
+            # hunk data before patching. Otherwise, preserve input
+            # line-endings.
+            h = h.getnormalized()
+
         # fast case first, no offsets, no fuzz
         old = h.old()
         # patch starts counting at 1 unless we are adding the file
@@ -441,7 +450,10 @@
         else:
             start = h.starta + self.offset - 1
         orig_start = start
-        if diffhelpers.testhunk(old, self.lines, start) == 0:
+        # if there's skew we want to emit the "(offset %d lines)" even
+        # when the hunk cleanly applies at start + skew, so skip the
+        # fast case code
+        if self.skew == 0 and diffhelpers.testhunk(old, self.lines, start) == 0:
             if h.rmfile():
                 self.unlink(self.fname)
             else:
@@ -457,7 +469,7 @@
             # override the start line and use eof here
             search_start = len(self.lines)
         else:
-            search_start = orig_start
+            search_start = orig_start + self.skew
 
         for fuzzlen in xrange(3):
             for toponly in [ True, False ]:
@@ -469,6 +481,7 @@
                         newlines = h.new(fuzzlen, toponly)
                         self.lines[l : l + len(old)] = newlines
                         self.offset += len(newlines) - len(old)
+                        self.skew = l - orig_start
                         self.dirty = 1
                         if fuzzlen:
                             fuzzstr = "with fuzz %d " % fuzzlen
@@ -488,7 +501,7 @@
                         return fuzzlen
         self.printfile(True)
         self.ui.warn(_("Hunk #%d FAILED at %d\n") % (h.number, orig_start))
-        self.rej.append(h)
+        self.rej.append(horig)
         return -1
 
 class hunk(object):
@@ -500,13 +513,39 @@
         self.b = []
         self.starta = self.lena = None
         self.startb = self.lenb = None
-        if context:
-            self.read_context_hunk(lr)
-        else:
-            self.read_unified_hunk(lr)
+        if lr is not None:
+            if context:
+                self.read_context_hunk(lr)
+            else:
+                self.read_unified_hunk(lr)
         self.create = create
         self.remove = remove and not create
 
+    def getnormalized(self):
+        """Return a copy with line endings normalized to LF."""
+
+        def normalize(lines):
+            nlines = []
+            for line in lines:
+                if line.endswith('\r\n'):
+                    line = line[:-2] + '\n'
+                nlines.append(line)
+            return nlines
+
+        # Dummy object, it is rebuilt manually
+        nh = hunk(self.desc, self.number, None, None, False, False)
+        nh.number = self.number
+        nh.desc = self.desc
+        nh.a = normalize(self.a)
+        nh.b = normalize(self.b)
+        nh.starta = self.starta
+        nh.startb = self.startb
+        nh.lena = self.lena
+        nh.lenb = self.lenb
+        nh.create = self.create
+        nh.remove = self.remove
+        return nh
+
     def read_unified_hunk(self, lr):
         m = unidesc.match(self.desc)
         if not m:
@@ -681,14 +720,6 @@
     def old(self, fuzz=0, toponly=False):
         return self.fuzzit(self.a, fuzz, toponly)
 
-    def newctrl(self):
-        res = []
-        for x in self.hunk:
-            c = x[0]
-            if c == ' ' or c == '+':
-                res.append(x)
-        return res
-
     def new(self, fuzz=0, toponly=False):
         return self.fuzzit(self.b, fuzz, toponly)
 
@@ -835,15 +866,13 @@
     fp.seek(pos)
     return dopatch, gitpatches
 
-def iterhunks(ui, fp, sourcefile=None, textmode=False):
+def iterhunks(ui, fp, sourcefile=None):
     """Read a patch and yield the following events:
     - ("file", afile, bfile, firsthunk): select a new target file.
     - ("hunk", hunk): a new hunk is ready to be applied, follows a
     "file" event.
     - ("git", gitchanges): current diff is in git format, gitchanges
     maps filenames to gitpatch records. Unique event.
-
-    If textmode is True, input line-endings are normalized to LF.
     """
     changed = {}
     current_hunk = None
@@ -857,7 +886,7 @@
     # our states
     BFILE = 1
     context = None
-    lr = linereader(fp, textmode)
+    lr = linereader(fp)
     dopatch = True
     # gitworkdone is True if a git operation (copy, rename, ...) was
     # performed already for the current file. Useful when the file
@@ -974,7 +1003,6 @@
     current_file = None
     gitpatches = None
     opener = util.opener(os.getcwd())
-    textmode = eolmode != 'strict'
 
     def closefile():
         if not current_file:
@@ -982,7 +1010,7 @@
         current_file.close()
         return len(current_file.rej)
 
-    for state, values in iterhunks(ui, fp, sourcefile, textmode):
+    for state, values in iterhunks(ui, fp, sourcefile):
         if state == 'hunk':
             if not current_file:
                 continue
@@ -1265,11 +1293,10 @@
     date1 = util.datestr(ctx1.date())
     man1 = ctx1.manifest()
 
-    if repo.ui.quiet:
-        r = None
-    else:
+    revs = None
+    if not repo.ui.quiet and not opts.git:
         hexfunc = repo.ui.debugflag and hex or short
-        r = [hexfunc(node) for node in [node1, node2] if node]
+        revs = [hexfunc(node) for node in [node1, node2] if node]
 
     if opts.git:
         copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
@@ -1322,8 +1349,7 @@
                 _addmodehdr(header, omode, nmode)
                 if util.binary(to) or util.binary(tn):
                     dodiff = 'binary'
-            r = None
-            header.insert(0, mdiff.diffline(r, a, b, opts))
+            header.insert(0, mdiff.diffline(revs, a, b, opts))
         if dodiff:
             if dodiff == 'binary':
                 text = b85diff(to, tn)
@@ -1331,7 +1357,7 @@
                 text = mdiff.unidiff(to, date1,
                                     # ctx2 date may be dynamic
                                     tn, util.datestr(ctx2.date()),
-                                    a, b, r, opts=opts)
+                                    a, b, revs, opts=opts)
             if header and (text or len(header) > 1):
                 yield ''.join(header)
             if text:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/map-cmdline.xml	Wed Dec 30 20:37:53 2009 +0100
@@ -0,0 +1,17 @@
+header = '<?xml version="1.0"?>\n<log>\n'
+footer = '</log>\n'
+
+changeset = '<logentry revision="{rev}" node="{node}">\n{branches}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n</logentry>\n'
+changeset_verbose = '<logentry revision="{rev}" node="{node}">\n{branches}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n<paths>\n{file_adds}{file_dels}{file_mods}</paths>\n{file_copies}</logentry>\n'
+
+file_add  = '<path action="A">{file_add|xmlescape}</path>\n'
+file_mod  = '<path action="M">{file_mod|xmlescape}</path>\n'
+file_del  = '<path action="R">{file_del|xmlescape}</path>\n'
+
+start_file_copies = '<copies>\n'
+file_copy = '<copy source="{source|xmlescape}">{name|xmlescape}</copy>\n'
+end_file_copies = '</copies>\n'
+
+parent = '<parent revision="{rev}" node="{node}" />\n'
+branch = '<branch>{branch|xmlescape}</branch>\n'
+tag = '<tag>{tag|xmlescape}</tag>\n'
--- a/mercurial/templates/monoblue/branches.tmpl	Wed Dec 30 03:39:34 2009 +0100
+++ b/mercurial/templates/monoblue/branches.tmpl	Wed Dec 30 20:37:53 2009 +0100
@@ -28,7 +28,7 @@
         </ul>
     </div>
 
-    <h2 class="no-link no-border">tags</h2>
+    <h2 class="no-link no-border">branches</h2>
     <table cellspacing="0">
 {entries%branchentry}
     </table>
--- a/setup.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/setup.py	Wed Dec 30 20:37:53 2009 +0100
@@ -104,9 +104,11 @@
     # If root is executing setup.py, but the repository is owned by
     # another user (as in "sudo python setup.py install") we will get
     # trust warnings since the .hg/hgrc file is untrusted. That is
-    # fine, we don't want to load it anyway.
+    # fine, we don't want to load it anyway.  Python may warn about
+    # a missing __init__.py in mercurial/locale, we also ignore that.
     err = [e for e in err.splitlines()
-           if not e.startswith('Not trusting file')]
+           if not e.startswith('Not trusting file') \
+              and not e.startswith('warning: Not importing')]
     if err:
         return ''
     return out
@@ -143,8 +145,8 @@
     if version.endswith('+'):
         version += time.strftime('%Y%m%d')
 elif os.path.exists('.hg_archival.txt'):
-    kw = dict([t.strip() for t in l.split(':', 1)]
-              for l in open('.hg_archival.txt'))
+    kw = dict([[t.strip() for t in l.split(':', 1)]
+               for l in open('.hg_archival.txt')])
     if 'tag' in kw:
         version =  kw['tag']
     elif 'latesttag' in kw:
--- a/tests/run-tests.py	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/run-tests.py	Wed Dec 30 20:37:53 2009 +0100
@@ -820,6 +820,7 @@
     os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
     os.environ['CDPATH'] = ''
     os.environ['COLUMNS'] = '80'
+    os.environ['http_proxy'] = ''
 
     global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
     TESTDIR = os.environ["TESTDIR"] = os.getcwd()
--- a/tests/test-acl	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-acl	Wed Dec 30 20:37:53 2009 +0100
@@ -44,7 +44,7 @@
 hg clone -r 0 a b
 
 echo '[extensions]' >> $HGRCPATH
-echo 'hgext.acl =' >> $HGRCPATH
+echo 'acl =' >> $HGRCPATH
 
 config=b/.hg/hgrc
 
--- a/tests/test-archive	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-archive	Wed Dec 30 20:37:53 2009 +0100
@@ -58,9 +58,9 @@
                     % (os.environ['HGPORT'], node, archive))
 sys.stdout.write(f.read())
 EOF
-http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
-http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
-http_proxy= python getarchive.py "$TIP" zip > archive.zip
+python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
+python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
+python getarchive.py "$TIP" zip > archive.zip
 unzip -t archive.zip | sed "s/$QTIP/TIP/"
 
 "$TESTDIR/killdaemons.py"
--- a/tests/test-bad-pull	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-bad-pull	Wed Dec 30 20:37:53 2009 +0100
@@ -23,7 +23,7 @@
 # give the server some time to start running
 sleep 1
 
-http_proxy= hg clone http://localhost:$HGPORT/foo copy2 2>&1 | \
+hg clone http://localhost:$HGPORT/foo copy2 2>&1 | \
     sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
 echo $?
 
--- a/tests/test-bisect	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-bisect	Wed Dec 30 20:37:53 2009 +0100
@@ -86,8 +86,9 @@
 set +e
 
 echo % test invalid command
+# assuming that the shell returns 127 if command not found ...
 hg bisect -r
-hg bisect --command './foobar' 2>&1 | sed 's|\(/bin/sh: \./foobar:\).*|\1 not found|'
+hg bisect --command 'exit 127'
 
 echo % test bisecting command
 cat > script.py <<EOF
--- a/tests/test-bisect.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-bisect.out	Wed Dec 30 20:37:53 2009 +0100
@@ -304,8 +304,7 @@
 summary:     msg 6
 
 % test invalid command
-/bin/sh: ./foobar: not found
-abort: failed to execute ./foobar
+abort: failed to execute exit 127
 % test bisecting command
 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-children	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-children	Wed Dec 30 20:37:53 2009 +0100
@@ -3,7 +3,7 @@
 
 cat <<EOF >> $HGRCPATH
 [extensions]
-hgext.children=
+children =
 EOF
 
 echo "% init"
--- a/tests/test-convert-baz	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-baz	Wed Dec 30 20:37:53 2009 +0100
@@ -10,7 +10,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert=" >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 echo % create baz archive
 baz make-archive baz@mercurial--convert hg-test-convert-baz
--- a/tests/test-convert-clonebranches	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-clonebranches	Wed Dec 30 20:37:53 2009 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo "[extensions]" >> $HGRCPATH
-echo "hgext.convert = " >> $HGRCPATH
+echo "convert = " >> $HGRCPATH
 echo "[convert]" >> $HGRCPATH
 echo "hg.tagsbranch=0" >> $HGRCPATH
 
--- a/tests/test-convert-darcs	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-darcs	Wed Dec 30 20:37:53 2009 +0100
@@ -4,7 +4,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert=" >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
 HOME=`pwd`/do_not_use_HOME_darcs; export HOME
--- a/tests/test-convert-filemap	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-filemap	Wed Dec 30 20:37:53 2009 +0100
@@ -3,8 +3,8 @@
 HGMERGE=true; export HGMERGE
 
 echo '[extensions]' >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
-echo 'hgext.convert =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
+echo 'convert =' >> $HGRCPATH
 
 glog()
 {
--- a/tests/test-convert-hg-startrev	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-hg-startrev	Wed Dec 30 20:37:53 2009 +0100
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 echo '[extensions]' >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
-echo 'hgext.convert =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
+echo 'convert =' >> $HGRCPATH
 
 glog()
 {
--- a/tests/test-convert-mtn	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-mtn	Wed Dec 30 20:37:53 2009 +0100
@@ -7,7 +7,7 @@
 mtndir=.monotone
 echo "[extensions]" >> $HGRCPATH
 echo "convert=" >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 HOME=`pwd`/do_not_use_HOME_mtn; export HOME
 # Windows version of monotone home
--- a/tests/test-convert-splicemap	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-splicemap	Wed Dec 30 20:37:53 2009 +0100
@@ -2,7 +2,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert=" >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 glog()
 {
--- a/tests/test-convert-svn-branches	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-svn-branches	Wed Dec 30 20:37:53 2009 +0100
@@ -9,7 +9,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
-echo "hgext.graphlog =" >> $HGRCPATH
+echo "graphlog =" >> $HGRCPATH
 
 svnadmin create svn-repo
 cat "$TESTDIR/svn/branches.svndump" | svnadmin load svn-repo > /dev/null
--- a/tests/test-convert-svn-source	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-svn-source	Wed Dec 30 20:37:53 2009 +0100
@@ -9,7 +9,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 svnadmin create svn-repo
 
--- a/tests/test-convert-svn-startrev	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-svn-startrev	Wed Dec 30 20:37:53 2009 +0100
@@ -9,7 +9,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
-echo "hgext.graphlog =" >> $HGRCPATH
+echo "graphlog =" >> $HGRCPATH
 
 svnadmin create svn-repo
 cat "$TESTDIR/svn/startrev.svndump" | svnadmin load svn-repo > /dev/null
--- a/tests/test-convert-svn-tags	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-svn-tags	Wed Dec 30 20:37:53 2009 +0100
@@ -9,7 +9,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
-echo "hgext.graphlog =" >> $HGRCPATH
+echo "graphlog =" >> $HGRCPATH
 
 svnadmin create svn-repo
 cat "$TESTDIR/svn/tags.svndump" | svnadmin load svn-repo > /dev/null
--- a/tests/test-convert-tla	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-convert-tla	Wed Dec 30 20:37:53 2009 +0100
@@ -10,7 +10,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert=" >> $HGRCPATH
-echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'graphlog =' >> $HGRCPATH
 
 echo % create tla archive
 tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
--- a/tests/test-help	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-help	Wed Dec 30 20:37:53 2009 +0100
@@ -9,11 +9,52 @@
 hg -v help shortlist | sed 's/[(]version [^)]*[)]/(version xxx)/'
 
 hg add -h
+
+echo %% test help option with version option
+hg add -h --version | sed 's/[(]version [^)]*[)]/(version xxx)/'
+
 hg add --skjdfks
+
+echo %% test ambiguous command help
+hg help ad
+
+echo %% test command without options
+hg help verify
+
 hg help diff
 hg help status
 hg -q help status
 hg help foo
 hg skjdfks
 
+cat > helpext.py <<EOF
+import os
+from mercurial import commands
+
+def nohelp(ui, *args, **kwargs):
+    pass
+
+cmdtable = {
+    "nohelp": (nohelp, [], "hg nohelp"),
+}
+
+commands.norepo += ' nohelp'
+EOF
+abspath=`pwd`/helpext.py
+
+echo '[extensions]' >> $HGRCPATH
+echo "helpext = $abspath" >> $HGRCPATH
+
+echo %% test command with no help text
+hg help nohelp
+
+echo %% test that default list of commands omits extension commands
+hg help
+
+echo %% test list of commands with command with no help text
+hg help helpext
+
+echo %% test a help topic
+hg help revs
+
 exit 0
--- a/tests/test-help.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-help.out	Wed Dec 30 20:37:53 2009 +0100
@@ -250,6 +250,31 @@
  -n --dry-run  do not perform actions, just print output
 
 use "hg -v help add" to show global options
+%% test help option with version option
+Mercurial Distributed SCM (version xxx)
+
+Copyright (C) 2005-2009 Matt Mackall <mpm@selenic.com> and others
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+hg add [OPTION]... [FILE]...
+
+add the specified files on the next commit
+
+    Schedule files to be version controlled and added to the repository.
+
+    The files will be added to the repository at the next commit. To undo an
+    add before that, see hg forget.
+
+    If no names are given, add all files to the repository.
+
+options:
+
+ -I --include  include names matching the given patterns
+ -X --exclude  exclude names matching the given patterns
+ -n --dry-run  do not perform actions, just print output
+
+use "hg -v help add" to show global options
 hg add: option --skjdfks not recognized
 hg add [OPTION]... [FILE]...
 
@@ -269,6 +294,26 @@
  -n --dry-run  do not perform actions, just print output
 
 use "hg -v help add" to show global options
+%% test ambiguous command help
+list of commands:
+
+ add         add the specified files on the next commit
+ addremove   add all new files, delete all missing files
+
+use "hg -v help ad" to show aliases and global options
+%% test command without options
+hg verify
+
+verify the integrity of the repository
+
+    Verify the integrity of the current repository.
+
+    This will perform an extensive check of the repository's integrity,
+    validating the hashes and checksums of each entry in the changelog,
+    manifest, and tracked files, as well as the integrity of their crosslinks
+    and indices.
+
+use "hg -v help verify" to show global options
 hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...
 
 diff repository (or selected files)
@@ -417,3 +462,121 @@
  update     update working directory
 
 use "hg help" for the full list of commands or "hg -v" for details
+%% test command with no help text
+hg nohelp
+
+(no help text available)
+
+use "hg -v help nohelp" to show global options
+%% test that default list of commands omits extension commands
+Mercurial Distributed SCM
+
+list of commands:
+
+ add          add the specified files on the next commit
+ addremove    add all new files, delete all missing files
+ annotate     show changeset information by line for each file
+ archive      create an unversioned archive of a repository revision
+ backout      reverse effect of earlier changeset
+ bisect       subdivision search of changesets
+ branch       set or show the current branch name
+ branches     list repository named branches
+ bundle       create a changegroup file
+ cat          output the current or given revision 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
+ forget       forget the specified files on the next commit
+ grep         search for a pattern in specified files and revisions
+ heads        show current repository heads or show branch heads
+ help         show help for a given topic or a help overview
+ identify     identify the working copy or specified revision
+ 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 current 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 directory or revision
+ paths        show aliases for remote repositories
+ 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
+ resolve      retry file merges from a merge or update
+ revert       restore individual files or directories to an earlier state
+ rollback     roll back the last transaction
+ root         print the root (top) of the current working directory
+ serve        export the repository via HTTP
+ showconfig   show combined config settings from all hgrc files
+ status       show changed files in the working directory
+ summary      summarize working directory state
+ tag          add one or more tags for the current or given revision
+ tags         list repository tags
+ tip          show the tip revision
+ unbundle     apply one or more changegroup files
+ update       update working directory
+ verify       verify the integrity of the repository
+ version      output version and copyright information
+
+enabled extensions:
+
+ helpext  (no help text available)
+
+additional help topics:
+
+ config       Configuration Files
+ dates        Date Formats
+ patterns     File Name Patterns
+ environment  Environment Variables
+ revisions    Specifying Single Revisions
+ multirevs    Specifying Multiple Revisions
+ diffs        Diff Formats
+ templating   Template Usage
+ urls         URL Paths
+ extensions   Using additional features
+
+use "hg -v help" to show aliases and global options
+%% test list of commands with command with no help text
+helpext extension - no help text available
+
+list of commands:
+
+ nohelp   (no help text available)
+
+use "hg -v help helpext" to show aliases and global options
+%% test a help topic
+Specifying Single Revisions
+
+    Mercurial supports several ways to specify individual revisions.
+
+    A plain integer is treated as a revision number. Negative integers are
+    treated as sequential offsets from the tip, with -1 denoting the tip, -2
+    denoting the revision prior to the tip, and so forth.
+
+    A 40-digit hexadecimal string is treated as a unique revision identifier.
+
+    A hexadecimal string less than 40 characters long is treated as a unique
+    revision identifier and is referred to as a short-form identifier. A
+    short-form identifier is only valid if it is the prefix of exactly one
+    full-length identifier.
+
+    Any other string is treated as a tag or branch name. A tag name is a
+    symbolic name associated with a revision identifier. A branch name denotes
+    the tipmost revision of that branch. Tag and branch names must not contain
+    the ":" character.
+
+    The reserved name "tip" is a special tag that always identifies the most
+    recent revision.
+
+    The reserved name "null" indicates the null revision. This is the revision
+    of an empty repository, and the parent of revision 0.
+
+    The reserved name "." indicates the working directory parent. If no
+    working directory is checked out, it is equivalent to null. If an
+    uncommitted merge is in progress, "." is the revision of the first parent.
--- a/tests/test-highlight	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-highlight	Wed Dec 30 20:37:53 2009 +0100
@@ -4,7 +4,7 @@
 
 cat <<EOF >> $HGRCPATH
 [extensions]
-hgext.highlight =
+highlight =
 [web]
 pygments_style = friendly
 EOF
--- a/tests/test-http	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-http	Wed Dec 30 20:37:53 2009 +0100
@@ -19,15 +19,15 @@
 cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
 echo % clone via stream
-http_proxy= hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
+hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
   sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
 hg verify -R copy
 
 echo % try to clone via stream, should use pull instead
-http_proxy= hg clone --uncompressed http://localhost:$HGPORT1/ copy2
+hg clone --uncompressed http://localhost:$HGPORT1/ copy2
 
 echo % clone via pull
-http_proxy= hg clone http://localhost:$HGPORT1/ copy-pull
+hg clone http://localhost:$HGPORT1/ copy-pull
 hg verify -R copy-pull
 
 cd test
--- a/tests/test-import-eol	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-import-eol	Wed Dec 30 20:37:53 2009 +0100
@@ -57,10 +57,25 @@
 python -c 'print repr(file("a","rb").read())'
 hg st
 
+echo % auto EOL on new file or source without any EOL
+python -c 'file("noeol", "wb").write("noeol")'
+hg add noeol
+hg commit -m 'add noeol'
+python -c 'file("noeol", "wb").write("noeol\r\nnoeol\n")'
+python -c 'file("neweol", "wb").write("neweol\nneweol\r\n")'
+hg add neweol
+hg diff --git > noeol.diff
+hg revert --no-backup noeol neweol
+rm neweol
+hg --traceback --config patch.eol='auto' import -m noeol noeol.diff
+python -c 'print repr(file("noeol","rb").read())'
+python -c 'print repr(file("neweol","rb").read())'
+hg st
+
 # Test --eol and binary patches
-python -c 'file("b", "wb").write("a\x00\nb")'
+python -c 'file("b", "wb").write("a\x00\nb\r\nd")'
 hg ci -Am addb
-python -c 'file("b", "wb").write("a\x00\nc")'
+python -c 'file("b", "wb").write("a\x00\nc\r\nd")'
 hg diff --git > bin.diff
 hg revert --no-backup b
 echo % binary patch with --eol
--- a/tests/test-import-eol.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-import-eol.out	Wed Dec 30 20:37:53 2009 +0100
@@ -17,7 +17,11 @@
 % auto EOL on CRLF file
 applying eol.diff
 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne'
+% auto EOL on new file or source without any EOL
+applying noeol.diff
+'noeol\r\nnoeol\n'
+'neweol\nneweol\r\n'
 adding b
 % binary patch with --eol
 applying bin.diff
-'a\x00\nc'
+'a\x00\nc\r\nd'
--- a/tests/test-incoming-outgoing	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-incoming-outgoing	Wed Dec 30 20:37:53 2009 +0100
@@ -14,8 +14,8 @@
 
 hg init new
 # http incoming
-http_proxy= hg -R new incoming http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
-http_proxy= hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R new incoming http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
 # local incoming
 hg -R new incoming test
 hg -R new incoming -r 4 test
@@ -25,7 +25,7 @@
 hg -R new incoming -l 2 -p --git test
 
 # test with --bundle
-http_proxy= hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
 hg -R new incoming --bundle test2.hg test
 
 # test the resulting bundles
@@ -50,5 +50,5 @@
 hg -R test-dev outgoing test
 echo "% limit to 3 changesets"
 hg -R test-dev outgoing -l 3 test
-http_proxy= hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
-http_proxy= hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
+hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
--- a/tests/test-keyword	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-keyword	Wed Dec 30 20:37:53 2009 +0100
@@ -2,9 +2,10 @@
 
 cat <<EOF >> $HGRCPATH
 [extensions]
-hgext.keyword =
-hgext.mq =
-hgext.notify =
+keyword =
+mq =
+notify =
+transplant =
 EOF
 
 # demo before [keyword] files are set up
@@ -337,6 +338,23 @@
 hg commit -m localresolve
 cat m
 
+echo % test restricted mode with transplant -b
+hg update 6
+hg branch foo
+mv a a.bak
+echo foobranch > a
+cat a.bak >> a
+rm a.bak
+hg commit -m 9foobranch
+hg update default
+hg -y transplant -b foo tip
+echo % no expansion in changeset
+hg tip -p
+echo % expansion in file
+head -n 2 a
+hg -q rollback
+hg -q update -C
+
 echo % switch off expansion
 echo % kwshrink with unknown file u
 cp a u
--- a/tests/test-keyword.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-keyword.out	Wed Dec 30 20:37:53 2009 +0100
@@ -1,6 +1,6 @@
 % hg kwdemo
 [extensions]
-hgext.keyword = 
+keyword = 
 [keyword]
 demo.txt = 
 [keywordmaps]
@@ -21,7 +21,7 @@
 $Revision: xxxxxxxxxxxx $
 $Source: /TMP/demo.txt,v $
 [extensions]
-hgext.keyword = 
+keyword = 
 [keyword]
 demo.txt = 
 [keywordmaps]
@@ -206,7 +206,7 @@
 % custom keyword expansion
 % try with kwdemo
 [extensions]
-hgext.keyword = 
+keyword = 
 [keyword]
 * = 
 b = ignore
@@ -420,6 +420,33 @@
 % resolve to local
 $Id: m 43dfd2854b5b Thu, 01 Jan 1970 00:00:00 +0000 test $
 bar
+% test restricted mode with transplant -b
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+marked working directory as branch foo
+created new head
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying 1c4378f51c4d
+1c4378f51c4d transplanted to 7d855abcab87
+% no expansion in changeset
+changeset:   11:7d855abcab87
+tag:         tip
+parent:      9:43dfd2854b5b
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     9foobranch
+
+diff -r 43dfd2854b5b -r 7d855abcab87 a
+--- a/a	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,3 +1,4 @@
++foobranch
+ expand $Id$
+ do not process $Id:
+ xxx $
+
+% expansion in file
+foobranch
+expand $Id: a 7d855abcab87 Thu, 01 Jan 1970 00:00:00 +0000 test $
 % switch off expansion
 % kwshrink with unknown file u
 overwriting a shrinking keywords
--- a/tests/test-mq	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq	Wed Dec 30 20:37:53 2009 +0100
@@ -368,8 +368,9 @@
 git = False
 EOF
 hg qdiff --git
+cd ..
 
-cd ..
+echo % test file addition in slow path
 hg init slow
 cd slow
 hg qinit
@@ -394,7 +395,7 @@
 hg qrefresh
 grep 'diff --git' .hg/patches/bar
 
-echo
+echo % test file move chains in the slow path
 hg up -C 1
 echo >> foo
 hg ci -m 'change foo again'
--- a/tests/test-mq-caches	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq-caches	Wed Dec 30 20:37:53 2009 +0100
@@ -2,7 +2,7 @@
 
 branches=.hg/branchheads.cache
 echo '[extensions]' >> $HGRCPATH
-echo 'hgext.mq=' >> $HGRCPATH
+echo 'mq =' >> $HGRCPATH
 
 show_branch_cache()
 {
--- a/tests/test-mq-merge	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq-merge	Wed Dec 30 20:37:53 2009 +0100
@@ -15,7 +15,7 @@
 }
 
 echo "[extensions]" >> $HGRCPATH
-echo "hgext.mq=" >> $HGRCPATH
+echo "mq =" >> $HGRCPATH
 
 # Commit two dummy files in "init" changeset
 hg init t
--- a/tests/test-mq-qnew	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq-qnew	Wed Dec 30 20:37:53 2009 +0100
@@ -58,3 +58,19 @@
 echo '% qnew -u with no username configured'
 HGUSER= hg qnew -u blue red
 cat ../.hg/patches/red
+
+echo '% fail when trying to import a merge'
+hg init merge
+cd merge
+touch a
+hg ci -Am null
+echo a >> a
+hg ci -m a
+hg up -r 0
+echo b >> a
+hg ci -m b
+hg merge -f 1
+hg resolve --mark a
+hg qnew -f merge
+
+exit 0
--- a/tests/test-mq-qnew.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq-qnew.out	Wed Dec 30 20:37:53 2009 +0100
@@ -35,3 +35,13 @@
 % qnew -u with no username configured
 From: blue
 
+% fail when trying to import a merge
+adding a
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+created new head
+merging a
+warning: conflicts during merge.
+merging a failed!
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+abort: cannot manage merge changesets
--- a/tests/test-mq-safety	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq-safety	Wed Dec 30 20:37:53 2009 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 echo '[extensions]' >> $HGRCPATH
-echo 'hgext.mq =' >> $HGRCPATH
+echo 'mq =' >> $HGRCPATH
 
 hg init repo
 cd repo
--- a/tests/test-mq.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-mq.out	Wed Dec 30 20:37:53 2009 +0100
@@ -380,6 +380,7 @@
 diff --git a/new b/copy
 copy from new
 copy to copy
+% test file addition in slow path
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
 created new head
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -415,7 +416,7 @@
 2 baz (foo)
 diff --git a/bar b/bar
 diff --git a/foo b/baz
-
+% test file move chains in the slow path
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
 popping bar
--- a/tests/test-notify.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-notify.out	Wed Dec 30 20:37:53 2009 +0100
@@ -6,7 +6,7 @@
 To use, configure the notify extension and enable it in hgrc like this:
 
   [extensions]
-  hgext.notify =
+  notify =
 
   [hooks]
   # one email for each incoming changeset
--- a/tests/test-parentrevspec	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-parentrevspec	Wed Dec 30 20:37:53 2009 +0100
@@ -23,7 +23,7 @@
 cd repo
 
 echo '[extensions]' > .hg/hgrc
-echo 'hgext.parentrevspec =' >> .hg/hgrc
+echo 'parentrevspec =' >> .hg/hgrc
 
 commit '0: add foo'
 commit '1: change foo 1'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-patch-offset	Wed Dec 30 20:37:53 2009 +0100
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+cat > writepatterns.py <<EOF
+import sys
+
+path = sys.argv[1]
+patterns = sys.argv[2:]
+
+fp = file(path, 'wb')
+for pattern in patterns:
+    count = int(pattern[0:-1])
+    char = pattern[-1] + '\n'
+    fp.write(char*count)
+fp.close()
+EOF
+
+echo % prepare repo
+hg init a
+cd a
+
+# These initial lines of Xs were not in the original file used to generate
+# the patch.  So all the patch hunks need to be applied to a constant offset
+# within this file.  If the offset isn't tracked then the hunks can be
+# applied to the wrong lines of this file.
+python ../writepatterns.py a 34X 10A 1B 10A 1C 10A 1B 10A 1D 10A 1B 10A 1E 10A 1B 10A
+hg commit -Am adda
+
+# This is a cleaner patch generated via diff
+# In this case it reproduces the problem when
+# the output of hg export does not
+echo % import patch
+hg import -v -m 'b' -d '2 0' - <<EOF
+--- a/a	2009-12-08 19:26:17.000000000 -0800
++++ b/a	2009-12-08 19:26:17.000000000 -0800
+@@ -9,7 +9,7 @@
+ A
+ A
+ B
+-A
++a
+ A
+ A
+ A
+@@ -53,7 +53,7 @@
+ A
+ A
+ B
+-A
++a
+ A
+ A
+ A
+@@ -75,7 +75,7 @@
+ A
+ A
+ B
+-A
++a
+ A
+ A
+ A
+EOF
+
+echo % compare imported changes against reference file
+python ../writepatterns.py aref 34X 10A 1B 1a 9A 1C 10A 1B 10A 1D 10A 1B 1a 9A 1E 10A 1B 1a 9A
+diff -u aref a
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-patch-offset.out	Wed Dec 30 20:37:53 2009 +0100
@@ -0,0 +1,10 @@
+% prepare repo
+adding a
+% import patch
+applying patch from stdin
+patching file a
+Hunk #1 succeeded at 43 (offset 34 lines).
+Hunk #2 succeeded at 87 (offset 34 lines).
+Hunk #3 succeeded at 109 (offset 34 lines).
+a
+% compare imported changes against reference file
--- a/tests/test-pull	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-pull	Wed Dec 30 20:37:53 2009 +0100
@@ -11,7 +11,7 @@
 cat hg.pid >> $DAEMON_PIDS
 cd ..
 
-http_proxy= hg clone --pull http://localhost:$HGPORT/ copy | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone --pull http://localhost:$HGPORT/ copy | sed -e 's,:[0-9][0-9]*/,/,'
 cd copy
 hg verify
 hg co
--- a/tests/test-purge	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-purge	Wed Dec 30 20:37:53 2009 +0100
@@ -2,7 +2,7 @@
 
 cat <<EOF >> $HGRCPATH
 [extensions]
-hgext.purge=
+purge =
 EOF
 
 echo % init
--- a/tests/test-static-http	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-static-http	Wed Dec 30 20:37:53 2009 +0100
@@ -2,7 +2,7 @@
 
 cp "$TESTDIR"/printenv.py .
 
-http_proxy= hg clone http://localhost:$HGPORT/ copy
+hg clone http://localhost:$HGPORT/ copy
 echo $?
 test -d copy || echo copy: No such file or directory
 
@@ -34,7 +34,7 @@
 
 cd ..
 
-http_proxy= hg clone static-http://localhost:$HGPORT/remote local | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/remote local | sed -e 's,:[0-9][0-9]*/,/,'
 
 cd local
 hg verify
@@ -47,13 +47,13 @@
 cd ../local
 echo '[hooks]' >> .hg/hgrc
 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
-http_proxy= hg pull | sed -e 's,:[0-9][0-9]*/,/,'
+hg pull | sed -e 's,:[0-9][0-9]*/,/,'
 
 echo '% trying to push'
 hg update
 echo more foo >> bar
 hg commit -m"test" -d "100000000 0"
-http_proxy= hg push | sed -e 's,:[0-9][0-9]*/,/,'
+hg push | sed -e 's,:[0-9][0-9]*/,/,'
 
 echo '% test with "/" URI (issue 747)'
 cd ..
@@ -62,7 +62,7 @@
 hg add a
 hg ci -ma
 
-http_proxy= hg clone static-http://localhost:$HGPORT/ local2 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/ local2 | sed -e 's,:[0-9][0-9]*/,/,'
 
 cd local2
 hg verify
@@ -73,7 +73,7 @@
 cd ..
 hg init remotempty
 
-http_proxy= hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,'
 
 cd local3
 hg verify
@@ -82,6 +82,6 @@
 echo '% test with non-repo'
 cd ..
 mkdir notarepo
-http_proxy= hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
+hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,'
 
 kill $!
--- a/tests/test-win32text.out	Wed Dec 30 03:39:34 2009 +0100
+++ b/tests/test-win32text.out	Wed Dec 30 20:37:53 2009 +0100
@@ -35,7 +35,7 @@
 and also consider adding:
 
 [extensions]
-hgext.win32text =
+win32text =
 [encode]
 ** = cleverencode:
 [decode]
@@ -214,7 +214,7 @@
 and also consider adding:
 
 [extensions]
-hgext.win32text =
+win32text =
 [encode]
 ** = cleverencode:
 [decode]