diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -150,6 +150,13 @@ class zipit(object): 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): diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -276,7 +276,10 @@ def keyword(repo, subset, x): 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] diff --git a/tests/test-archive.t b/tests/test-archive.t --- a/tests/test-archive.t +++ b/tests/test-archive.t @@ -219,5 +219,19 @@ empty repo $ 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 diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -211,6 +211,10 @@ quoting needed 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