merge with stable

This commit is contained in:
Martin Geisler 2010-09-20 15:42:58 +02:00
commit 989dda555a
4 changed files with 29 additions and 1 deletions

View File

@ -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):

View File

@ -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]

View File

@ -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

View File

@ -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