changeset 12321:11db6fa2961e

merge with stable
author Martin Geisler <mg@aragost.com>
date Mon, 20 Sep 2010 15:42:58 +0200
parents d643ae555a4d (current diff) 40c40c6f20b8 (diff)
children 510afb31cf99
files mercurial/archival.py mercurial/revset.py tests/test-archive.t tests/test-revset.t
diffstat 4 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Fri Sep 17 12:45:13 2010 -0500
+++ b/mercurial/archival.py	Mon Sep 20 15:42:58 2010 +0200
@@ -150,6 +150,13 @@
         self.z = zipfile.ZipFile(dest, 'w',
                                  compress and zipfile.ZIP_DEFLATED or
                                  zipfile.ZIP_STORED)
+
+        # Python's zipfile module emits deprecation warnings if we try
+        # to store files with a date before 1980.
+        epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0))
+        if mtime < epoch:
+            mtime = epoch
+
         self.date_time = time.gmtime(mtime)[:6]
 
     def addfile(self, name, mode, islink, data):
--- a/mercurial/revset.py	Fri Sep 17 12:45:13 2010 -0500
+++ b/mercurial/revset.py	Mon Sep 20 15:42:58 2010 +0200
@@ -276,7 +276,10 @@
     return l
 
 def grep(repo, subset, x):
-    gr = re.compile(getstring(x, _("grep wants a string")))
+    try:
+        gr = re.compile(getstring(x, _("grep wants a string")))
+    except re.error, e:
+        raise error.ParseError(_('invalid match pattern: %s') % e)
     l = []
     for r in subset:
         c = repo[r]
--- a/tests/test-archive.t	Fri Sep 17 12:45:13 2010 -0500
+++ b/tests/test-archive.t	Mon Sep 20 15:42:58 2010 +0200
@@ -219,5 +219,19 @@
   $ hg archive ../test-empty
   abort: no working directory: please specify a revision
   [255]
+old file -- date clamped to 1980
+
+  $ touch -d 1975-01-01 old
+  $ hg add old
+  $ hg commit -m old
+  $ hg archive ../old.zip
+  $ unzip -l ../old.zip
+  Archive:  ../old.zip
+    Length      Date    Time    Name
+  ---------  ---------- -----   ----
+        147  1980-01-01 00:00   old/.hg_archival.txt
+          0  1980-01-01 00:00   old/old
+  ---------                     -------
+        147                     2 files
 
   $ exit 0
--- a/tests/test-revset.t	Fri Sep 17 12:45:13 2010 -0500
+++ b/tests/test-revset.t	Mon Sep 20 15:42:58 2010 +0200
@@ -211,6 +211,10 @@
   9
   $ log 'grep("issue\d+")'
   6
+  $ try 'grep("(")' # invalid regular expression
+  ('func', ('symbol', 'grep'), ('string', '('))
+  hg: parse error: invalid match pattern: unbalanced parenthesis
+  [255]
   $ log 'head()'
   0
   1