changeset 2539:8a8d9ada4528

Merged WSGI fixes from http://hg.omnifarious.org/~hopper/webmerc/
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 30 Jun 2006 21:36:45 +0200
parents 7a90e0c77f43 (diff) f4b7d71c1c60 (current diff)
children 800a582e2405
files mercurial/templater.py templates/map-raw
diffstat 18 files changed, 202 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jun 30 09:50:25 2006 -0700
+++ b/Makefile	Fri Jun 30 21:36:45 2006 +0200
@@ -37,12 +37,20 @@
 	rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
 	$(MAKE) -C doc clean
 
-install: all
+install: install-bin install-doc
+
+install-bin: build
 	$(PYTHON) setup.py install --prefix="$(PREFIX)" --force
+
+install-doc: doc
 	cd doc && $(MAKE) $(MFLAGS) install
 
-install-home: all
+install-home: install-home-bin install-home-doc
+
+install-home-bin: build
 	$(PYTHON) setup.py install --home="$(HOME)" --force
+
+install-home-doc: doc
 	cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
 
 dist:	tests dist-notests
@@ -57,5 +65,5 @@
 	cd tests && $(PYTHON) run-tests.py $@
 
 
-.PHONY: help all local build doc clean install install-home dist dist-notests tests
-
+.PHONY: help all local build doc clean install install-bin install-doc \
+	install-home install-home-bin install-home-doc dist dist-notests tests
--- a/contrib/macosx/Readme.html	Fri Jun 30 09:50:25 2006 -0700
+++ b/contrib/macosx/Readme.html	Fri Jun 30 21:36:45 2006 +0200
@@ -18,13 +18,10 @@
 <p class="p2"><br></p>
 <p class="p3">This is <i>not</i> a stand-alone version of Mercurial.</p>
 <p class="p2"><br></p>
-<p class="p3">To use it, you must have the “official unofficial” MacPython 2.4.1 installed.</p>
+<p class="p3">To use it, you must have the Universal MacPython 2.4.3 from <a href="http://www.python.org">www.python.org</a> installed.</p>
 <p class="p2"><br></p>
-<p class="p3">You can download MacPython 2.4.1 from here:</p>
-<p class="p4"><span class="s1"><a href="http://python.org/ftp/python/2.4.1/MacPython-OSX-2.4.1-1.dmg">http://python.org/ftp/python/2.4.1/MacPython-OSX-2.4.1-1.dmg</a></span></p>
-<p class="p2"><br></p>
-<p class="p3">For more information on MacPython, go here:</p>
-<p class="p4"><span class="s1"><a href="http://undefined.org/python/">http://undefined.org/python</a></span></p>
+<p class="p3">You can download MacPython 2.4.3 from here:</p>
+<p class="p4"><span class="s1"><a href="http://www.python.org/ftp/python/2.4.3/Universal-MacPython-2.4.3-2006-04-07.dmg">http://www.python.org/ftp/python/2.4.3/Universal-MacPython-2.4.3-2006-04-07.dmg</a></span></p>
 <p class="p2"><br></p>
 <p class="p1"><b>After you install</b></p>
 <p class="p2"><br></p>
--- a/contrib/macosx/Welcome.html	Fri Jun 30 09:50:25 2006 -0700
+++ b/contrib/macosx/Welcome.html	Fri Jun 30 21:36:45 2006 +0200
@@ -12,6 +12,6 @@
 <body>
 <p class="p1">This is a prepackaged release of <a href="http://www.selenic.com/mercurial">Mercurial</a> for Mac OS X.</p>
 <p class="p2"><br></p>
-<p class="p1">It is based on Mercurial 0.8.</p>
+<p class="p1">It is based on Mercurial 0.9.</p>
 </body>
 </html>
--- a/contrib/mercurial.el	Fri Jun 30 09:50:25 2006 -0700
+++ b/contrib/mercurial.el	Fri Jun 30 21:36:45 2006 +0200
@@ -653,7 +653,7 @@
 you're already familiar with VC, the same keybindings and functions
 will generally work.
 
-Below is a list of many common SCM tasks.  In the list, `G/L'
+Below is a list of many common SCM tasks.  In the list, `G/L\'
 indicates whether a key binding is global (G) to a repository or local
 (L) to a file.  Many commands take a prefix argument.
 
@@ -682,6 +682,8 @@
 Update working directory after pull   G    C-c h u      hg-update
 See changes that can be pushed        G    C-c h .      hg-outgoing
 Push changes                          G    C-c h >      hg-push"
+  (unless vc-make-backup-files
+    (set (make-local-variable 'backup-inhibited) t))
   (run-hooks 'hg-mode-hook))
 
 (defun hg-find-file-hook ()
@@ -729,6 +731,8 @@
       (goto-char 0)
       (cd (hg-root path)))
     (when update
+      (unless vc-make-backup-files
+	(set (make-local-variable 'backup-inhibited) t))
       (with-current-buffer buf
 	(hg-mode-line)))))
 
@@ -968,6 +972,7 @@
       (cd (hg-root path)))
     (when update
       (with-current-buffer buf
+	(set (make-local-variable 'backup-inhibited) nil)
 	(hg-mode-line)))))
 
 (defun hg-incoming (&optional repo)
--- a/hgext/mq.py	Fri Jun 30 09:50:25 2006 -0700
+++ b/hgext/mq.py	Fri Jun 30 21:36:45 2006 +0200
@@ -1083,6 +1083,7 @@
     return 0
 
 def commit(ui, repo, *pats, **opts):
+    """commit changes in the queue repository"""
     q = repomap[repo]
     r = q.qrepo()
     if not r: raise util.Abort('no queue repository')
@@ -1264,7 +1265,7 @@
          'hg qimport [-e] [-n NAME] [-f] FILE...'),
     "^qinit":
         (init,
-         [('c', 'create-repo', None, 'create patch repository')],
+         [('c', 'create-repo', None, 'create queue repository')],
          'hg qinit [-c]'),
     "qnew":
         (new,
--- a/mercurial/changelog.py	Fri Jun 30 09:50:25 2006 -0700
+++ b/mercurial/changelog.py	Fri Jun 30 21:36:45 2006 +0200
@@ -39,21 +39,10 @@
     def add(self, manifest, list, desc, transaction, p1=None, p2=None,
                   user=None, date=None):
         if date:
-            # validate explicit (probably user-specified) date and
-            # time zone offset. values must fit in signed 32 bits for
-            # current 32-bit linux runtimes. timezones go from UTC-12
-            # to UTC+14
-            try:
-                when, offset = map(int, date.split(' '))
-            except ValueError:
-                raise ValueError(_('invalid date: %r') % date)
-            if abs(when) > 0x7fffffff:
-                raise ValueError(_('date exceeds 32 bits: %d') % when)
-            if offset < -50400 or offset > 43200:
-                raise ValueError(_('impossible time zone offset: %d') % offset)
+            parseddate = "%d %d" % util.parsedate(date)
         else:
-            date = "%d %d" % util.makedate()
+            parseddate = "%d %d" % util.makedate()
         list.sort()
-        l = [hex(manifest), user, date] + list + ["", desc]
+        l = [hex(manifest), user, parseddate] + list + ["", desc]
         text = "\n".join(l)
         return self.addrevision(text, transaction, self.count(), p1, p2)
--- a/mercurial/commands.py	Fri Jun 30 09:50:25 2006 -0700
+++ b/mercurial/commands.py	Fri Jun 30 21:36:45 2006 +0200
@@ -1721,9 +1721,10 @@
 
     You can import a patch straight from a mail message.  Even patches
     as attachments work (body part must be type text/plain or
-    text/x-patch to be used).  Sender and subject line of email
-    message are used as default committer and commit message.  Any
-    text/plain body part before first diff is added to commit message.
+    text/x-patch to be used).  From and Subject headers of email
+    message are used as default committer and commit message.  All
+    text/plain body parts before first diff are added to commit
+    message.
 
     If imported patch was generated by hg export, user and description
     from patch override values from message headers and body.  Values
@@ -1874,7 +1875,10 @@
                 # use the created uncompressed bundlerepo
                 other = bundlerepo.bundlerepository(ui, repo.root, fname)
 
-        o = other.changelog.nodesbetween(incoming)[0]
+        revs = None
+        if opts['rev']:
+            revs = [other.lookup(rev) for rev in opts['rev']]
+        o = other.changelog.nodesbetween(incoming, revs)[0]
         if opts['newest_first']:
             o.reverse()
         displayer = show_changeset(ui, other, opts)
@@ -2084,13 +2088,16 @@
         ui.setconfig("ui", "ssh", opts['ssh'])
     if opts['remotecmd']:
         ui.setconfig("ui", "remotecmd", opts['remotecmd'])
+    revs = None
+    if opts['rev']:
+        revs = [repo.lookup(rev) for rev in opts['rev']]
 
     other = hg.repository(ui, dest)
     o = repo.findoutgoing(other, force=opts['force'])
     if not o:
         ui.status(_("no changes found\n"))
         return
-    o = repo.changelog.nodesbetween(o)[0]
+    o = repo.changelog.nodesbetween(o, revs)[0]
     if opts['newest_first']:
         o.reverse()
     displayer = show_changeset(ui, repo, opts)
@@ -3021,11 +3028,13 @@
           ('n', 'newest-first', None, _('show newest record first')),
           ('', 'bundle', '', _('file to store the bundles into')),
           ('p', 'patch', None, _('show patch')),
+          ('r', 'rev', [], _('a specific revision you would like to pull')),
           ('', 'template', '', _('display with template')),
           ('e', 'ssh', '', _('specify ssh command to use')),
           ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
-         _('hg incoming [-p] [-n] [-M] [--bundle FILENAME] [SOURCE]')),
+         _('hg incoming [-p] [-n] [-M] [-r REV]...'
+           '[--bundle FILENAME] [SOURCE]')),
     "^init": (init, [], _('hg init [DEST]')),
     "locate":
         (locate,
@@ -3063,12 +3072,13 @@
            _('run even when remote repository is unrelated')),
           ('p', 'patch', None, _('show patch')),
           ('', 'style', '', _('display using template map file')),
+          ('r', 'rev', [], _('a specific revision you would like to push')),
           ('n', 'newest-first', None, _('show newest record first')),
           ('', 'template', '', _('display with template')),
           ('e', 'ssh', '', _('specify ssh command to use')),
           ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
-         _('hg outgoing [-M] [-p] [-n] [DEST]')),
+         _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')),
     "^parents":
         (parents,
          [('b', 'branches', None, _('show branches')),
--- a/mercurial/templater.py	Fri Jun 30 09:50:25 2006 -0700
+++ b/mercurial/templater.py	Fri Jun 30 21:36:45 2006 +0200
@@ -225,6 +225,10 @@
     '''turn a (timestamp, tzoff) tuple into an iso 8631 date and time.'''
     return util.datestr(date, format='%Y-%m-%d %H:%M')
 
+def hgdate(date):
+    '''turn a (timestamp, tzoff) tuple into an hg cset timestamp.'''
+    return "%d %d" % date
+
 def nl2br(text):
     '''replace raw newlines with xhtml line breaks.'''
     return text.replace('\n', '<br/>\n')
@@ -282,6 +286,7 @@
     "fill76": lambda x: fill(x, width=76),
     "firstline": lambda x: x.splitlines(1)[0].rstrip('\r\n'),
     "tabindent": lambda x: indent(x, '\t'),
+    "hgdate": hgdate,
     "isodate": isodate,
     "obfuscate": obfuscate,
     "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--",
--- a/mercurial/util.py	Fri Jun 30 09:50:25 2006 -0700
+++ b/mercurial/util.py	Fri Jun 30 21:36:45 2006 +0200
@@ -859,6 +859,49 @@
         s += " %+03d%02d" % (-tz / 3600, ((-tz % 3600) / 60))
     return s
 
+def strdate(string, format='%a %b %d %H:%M:%S %Y'):
+    """parse a localized time string and return a (unixtime, offset) tuple.
+    if the string cannot be parsed, ValueError is raised."""
+    def hastimezone(string):
+        return (string[-4:].isdigit() and
+               (string[-5] == '+' or string[-5] == '-') and
+               string[-6].isspace())
+
+    if hastimezone(string):
+        date, tz = string.rsplit(None, 1)
+        tz = int(tz)
+        offset = - 3600 * (tz / 100) - 60 * (tz % 100)
+    else:
+        date, offset = string, 0
+    when = int(time.mktime(time.strptime(date, format))) + offset
+    return when, offset
+
+def parsedate(string, formats=('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M')):
+    """parse a localized time string and return a (unixtime, offset) tuple.
+    The date may be a "unixtime offset" string or in one of the specified
+    formats."""
+    try:
+        when, offset = map(int, string.split(' '))
+    except ValueError:
+        for format in formats:
+            try:
+                when, offset = strdate(string, format)
+            except ValueError:
+                pass
+            else:
+                break
+        else:
+            raise ValueError(_('invalid date: %r') % string)
+    # validate explicit (probably user-specified) date and
+    # time zone offset. values must fit in signed 32 bits for
+    # current 32-bit linux runtimes. timezones go from UTC-12
+    # to UTC+14
+    if abs(when) > 0x7fffffff:
+        raise ValueError(_('date exceeds 32 bits: %d') % when)
+    if offset < -50400 or offset > 43200:
+        raise ValueError(_('impossible time zone offset: %d') % offset)
+    return when, offset
+
 def shortuser(user):
     """Return a short representation of a user name or email address."""
     f = user.find('@')
--- a/templates/changeset-raw.tmpl	Fri Jun 30 09:50:25 2006 -0700
+++ b/templates/changeset-raw.tmpl	Fri Jun 30 21:36:45 2006 +0200
@@ -1,7 +1,7 @@
 #header#
 # HG changeset patch
 # User #author#
-# Date #date|date#
+# Date #date|hgdate#
 # Node ID #node#
 #parent%changesetparent#
 #desc#
--- a/templates/map-raw	Fri Jun 30 09:50:25 2006 -0700
+++ b/templates/map-raw	Fri Jun 30 21:36:45 2006 +0200
@@ -5,8 +5,8 @@
 difflineminus = '#line#'
 difflineat = '#line#'
 diffline = '#line#'
-changesetparent = '# parent: #node#'
-changesetchild = '# child: #node#'
+changesetparent = '# Parent #node#'
+changesetchild = '# Child #node#'
 filenodelink = ''
 filerevision = '#rawfileheader##raw#'
 fileline = '#line#'
--- a/tests/test-globalopts	Fri Jun 30 09:50:25 2006 -0700
+++ b/tests/test-globalopts	Fri Jun 30 21:36:45 2006 +0200
@@ -62,7 +62,7 @@
 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+]*\|unknown\)/version xxx/'
+hg --version -q | sed 's/version [^)]*/version xxx/'
 
 echo %% -h/--help
 hg -h
--- a/tests/test-hup	Fri Jun 30 09:50:25 2006 -0700
+++ b/tests/test-hup	Fri Jun 30 21:36:45 2006 +0200
@@ -7,7 +7,7 @@
 P=$!
 (echo lock; echo addchangegroup; sleep 5) > p &
 Q=$!
-sleep 1
+sleep 3
 kill -HUP $P
 wait
 ls .hg
--- a/tests/test-incoming-outgoing	Fri Jun 30 09:50:25 2006 -0700
+++ b/tests/test-incoming-outgoing	Fri Jun 30 21:36:45 2006 +0200
@@ -14,8 +14,10 @@
 hg init new
 # http incoming
 http_proxy= hg -R new incoming http://localhost:20059/
+http_proxy= hg -R new incoming -r 4 http://localhost:20059/
 # local incoming
 hg -R new incoming test
+hg -R new incoming -r 4 test
 
 # test with --bundle
 http_proxy= hg -R new incoming --bundle test.hg http://localhost:20059/
@@ -42,5 +44,6 @@
 cd ..
 hg -R test-dev outgoing test
 http_proxy= hg -R test-dev outgoing http://localhost:20059/
+http_proxy= hg -R test-dev outgoing -r 11 http://localhost:20059/
 
 kill `cat test/hg.pid`
--- a/tests/test-incoming-outgoing.out	Fri Jun 30 09:50:25 2006 -0700
+++ b/tests/test-incoming-outgoing.out	Fri Jun 30 21:36:45 2006 +0200
@@ -75,6 +75,31 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     4
 
+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
@@ -121,6 +146,31 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     4
 
+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
@@ -270,3 +320,19 @@
 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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-parse-date	Fri Jun 30 21:36:45 2006 +0200
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+hg init
+echo "test-parse-date" > a
+hg add a
+hg ci -d "2006-02-01 13:00:30" -m "rev 0"
+echo "hi!" >> a
+hg ci -d "2006-02-01 13:00:30 -0500" -m "rev 1"
+hg tag -d "2006-04-15 13:30" "Hi"
+hg backout --merge -d "2006-04-15 13:30 +0200" -m "rev 3" 1
+hg ci -d "1150000000 14400" -m "rev 4 (merge)"
+echo "fail" >> a
+hg ci -d "should fail" -m "fail"
+hg ci -d "100000000000000000 1400" -m "fail"
+hg ci -d "100000 1400000" -m "fail"
+hg log --template '{date|date}\n'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-parse-date.out	Fri Jun 30 21:36:45 2006 +0200
@@ -0,0 +1,19 @@
+reverting a
+changeset 3:107ce1ee2b43 backs out changeset 1:25a1420a55f8
+merging with changeset 2:99a1acecff55
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+abort: invalid date: 'should fail'
+transaction abort!
+rollback completed
+abort: date exceeds 32 bits: 100000000000000000
+transaction abort!
+rollback completed
+abort: impossible time zone offset: 1400000
+transaction abort!
+rollback completed
+Sun Jun 11 00:26:40 2006 -0400
+Sat Apr 15 13:30:00 2006 +0200
+Sat Apr 15 13:30:00 2006 +0000
+Wed Feb 01 13:00:30 2006 -0500
+Wed Feb 01 13:00:30 2006 +0000
--- a/tests/test-pull-pull-corruption2	Fri Jun 30 09:50:25 2006 -0700
+++ b/tests/test-pull-pull-corruption2	Fri Jun 30 21:36:45 2006 +0200
@@ -20,5 +20,6 @@
 sleep 1
 
 hg clone --pull -U version2 corrupted
+wait
 hg -R corrupted verify
 hg -R version2 verify