merge with stable
authorMartin Geisler <mg@aragost.com>
Mon, 20 Sep 2010 15:42:58 +0200
changeset 12321 11db6fa2961e
parent 12318 d643ae555a4d (current diff)
parent 12320 40c40c6f20b8 (diff)
child 12322 510afb31cf99
merge with stable
mercurial/archival.py
mercurial/revset.py
tests/test-archive.t
tests/test-revset.t
--- 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