Mercurial > hg-stable
changeset 6233:14a4fdf9037f
Merge with main
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 11 Mar 2008 16:04:25 -0700 |
parents | 59200a2de7bf (current diff) c7253d1a774e (diff) |
children | a47462264906 |
files | |
diffstat | 12 files changed, 45 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/imerge.py Tue Mar 11 23:54:03 2008 +0100 +++ b/hgext/imerge.py Tue Mar 11 16:04:25 2008 -0700 @@ -79,7 +79,8 @@ try: parents = [self.repo.changectx(n) for n in status[:2]] except revlog.LookupError, e: - raise util.Abort('merge parent %s not in repository' % e.name) + raise util.Abort(_('merge parent %s not in repository') % + short(e.name)) status = status[2:] conflicts = int(status.pop(0)) * 3
--- a/hgext/notify.py Tue Mar 11 23:54:03 2008 +0100 +++ b/hgext/notify.py Tue Mar 11 16:04:25 2008 -0700 @@ -210,9 +210,7 @@ del msg['From'] msg['From'] = sender - msg['Date'] = util.datestr(date=util.makedate(), - format="%a, %d %b %Y %H:%M:%S", - timezone=True) + msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") fix_subject() fix_sender()
--- a/hgext/patchbomb.py Tue Mar 11 23:54:03 2008 +0100 +++ b/hgext/patchbomb.py Tue Mar 11 16:04:25 2008 -0700 @@ -391,8 +391,7 @@ m['In-Reply-To'] = parent else: parent = m['Message-Id'] - m['Date'] = util.datestr(date=start_time, - format="%a, %d %b %Y %H:%M:%S", timezone=True) + m['Date'] = util.datestr(start_time, "%a, %d %b %Y %H:%M:%S %1%2") start_time = (start_time[0] + 1, start_time[1]) m['From'] = sender @@ -419,8 +418,7 @@ elif opts.get('mbox'): ui.status('Writing ', m['Subject'], ' ...\n') fp = open(opts.get('mbox'), 'In-Reply-To' in m and 'ab+' or 'wb+') - date = util.datestr(date=start_time, - format='%a %b %d %H:%M:%S %Y', timezone=False) + date = util.datestr(start_time, '%a %b %d %H:%M:%S %Y') fp.write('From %s %s\n' % (sender_addr, date)) fp.write(m.as_string(0)) fp.write('\n\n')
--- a/mercurial/bundlerepo.py Tue Mar 11 23:54:03 2008 +0100 +++ b/mercurial/bundlerepo.py Tue Mar 11 16:04:25 2008 -0700 @@ -48,7 +48,8 @@ continue for p in (p1, p2): if not p in self.nodemap: - raise revlog.LookupError(hex(p1), _("unknown parent %s") % short(p1)) + raise revlog.LookupError(p1, self.indexfile, + _("unknown parent")) if linkmapper is None: link = n else:
--- a/mercurial/context.py Tue Mar 11 23:54:03 2008 +0100 +++ b/mercurial/context.py Tue Mar 11 16:04:25 2008 -0700 @@ -100,13 +100,15 @@ try: return self._manifest[path], self._manifest.flags(path) except KeyError: - raise revlog.LookupError(path, _("'%s' not found in manifest") % path) + raise revlog.LookupError(self._node, path, + _('not found in manifest')) if '_manifestdelta' in self.__dict__ or path in self.files(): if path in self._manifestdelta: return self._manifestdelta[path], self._manifestdelta.flags(path) node, flag = self._repo.manifest.find(self._changeset[0], path) if not node: - raise revlog.LookupError(path, _("'%s' not found in manifest") % path) + raise revlog.LookupError(self._node, path, + _('not found in manifest')) return node, flag
--- a/mercurial/revlog.py Tue Mar 11 23:54:03 2008 +0100 +++ b/mercurial/revlog.py Tue Mar 11 16:04:25 2008 -0700 @@ -33,11 +33,11 @@ pass class LookupError(RevlogError): - def __init__(self, name, message=None): - if message is None: - message = _('not found: %s') % name - RevlogError.__init__(self, message) + def __init__(self, name, index, message): self.name = name + if isinstance(name, str) and len(name) == 20: + name = short(name) + RevlogError.__init__(self, _('%s@%s: %s') % (index, name, message)) def getoffset(q): return int(q >> 16) @@ -519,7 +519,7 @@ try: return self.nodemap[node] except KeyError: - raise LookupError(hex(node), _('%s: no node %s') % (self.indexfile, hex(node))) + raise LookupError(node, self.indexfile, _('no node')) def node(self, rev): return self.index[rev][7] def linkrev(self, node): @@ -839,8 +839,8 @@ for n in self.nodemap: if n.startswith(bin_id) and hex(n).startswith(id): if node is not None: - raise LookupError(hex(node), - _("Ambiguous identifier")) + raise LookupError(id, self.indexfile, + _('ambiguous identifier')) node = n if node is not None: return node @@ -859,7 +859,7 @@ if n: return n - raise LookupError(id, _("No match found")) + raise LookupError(id, self.indexfile, _('no match found')) def cmp(self, node, text): """compare text with a given file revision""" @@ -1170,13 +1170,13 @@ for p in (p1, p2): if not p in self.nodemap: - raise LookupError(hex(p), _("unknown parent %s") % short(p)) + raise LookupError(p, self.indexfile, _('unknown parent')) if not chain: # retrieve the parent revision of the delta chain chain = p1 if not chain in self.nodemap: - raise LookupError(hex(chain), _("unknown base %s") % short(chain[:4])) + raise LookupError(chain, self.indexfile, _('unknown base')) # full versions are inserted when the needed deltas become # comparable to the uncompressed text or when the previous
--- a/mercurial/templatefilters.py Tue Mar 11 23:54:03 2008 +0100 +++ b/mercurial/templatefilters.py Tue Mar 11 16:04:25 2008 -0700 @@ -69,14 +69,6 @@ except IndexError: return '' -def isodate(date): - '''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') @@ -142,13 +134,13 @@ "fill76": lambda x: fill(x, width=76), "firstline": firstline, "tabindent": lambda x: indent(x, '\t'), - "hgdate": hgdate, - "isodate": isodate, + "hgdate": lambda x: "%d %d" % x, + "isodate": lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2'), "obfuscate": obfuscate, "permissions": permissions, "person": person, - "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), - "rfc3339date": lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S", True, "%+03d:%02d"), + "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2"), + "rfc3339date": lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2"), "short": lambda x: x[:12], "shortdate": util.shortdate, "stringify": templater.stringify,
--- a/mercurial/util.py Tue Mar 11 23:54:03 2008 +0100 +++ b/mercurial/util.py Tue Mar 11 16:04:25 2008 -0700 @@ -1524,20 +1524,23 @@ tz = time.timezone return time.mktime(lt), tz -def datestr(date=None, format='%a %b %d %H:%M:%S %Y', timezone=True, timezone_format=" %+03d%02d"): +def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'): """represent a (unixtime, offset) tuple as a localized time. unixtime is seconds since the epoch, and offset is the time zone's number of seconds away from UTC. if timezone is false, do not append time zone to string.""" t, tz = date or makedate() + if "%1" in format or "%2" in format: + sign = (tz > 0) and "-" or "+" + minutes = abs(tz) / 60 + format = format.replace("%1", "%c%02d" % (sign, minutes / 60)) + format = format.replace("%2", "%02d" % (minutes % 60)) s = time.strftime(format, time.gmtime(float(t) - tz)) - if timezone: - s += timezone_format % (int(-tz / 3600.0), ((-tz % 3600) / 60)) return s def shortdate(date=None): """turn (timestamp, tzoff) tuple into iso 8631 date.""" - return datestr(date, format='%Y-%m-%d', timezone=False) + return datestr(date, format='%Y-%m-%d') def strdate(string, format, defaults=[]): """parse a localized time string and return a (unixtime, offset) tuple. @@ -1545,9 +1548,10 @@ def timezone(string): tz = string.split()[-1] if tz[0] in "+-" and len(tz) == 5 and tz[1:].isdigit(): - tz = int(tz) - offset = - 3600 * (tz / 100) - 60 * (tz % 100) - return offset + sign = (tz[0] == "+") and 1 or -1 + hours = int(tz[1:3]) + minutes = int(tz[3:5]) + return -sign * (hours * 60 + minutes) * 60 if tz == "GMT" or tz == "UTC": return 0 return None @@ -1582,7 +1586,7 @@ """ if not date: return 0, 0 - if type(date) is type((0, 0)) and len(date) == 2: + if isinstance(date, tuple) and len(date) == 2: return date if not formats: formats = defaultdateformats @@ -1598,10 +1602,8 @@ if part not in defaults: if part[0] in "HMS": defaults[part] = "00" - elif part[0] in "dm": - defaults[part] = "1" else: - defaults[part] = datestr(now, "%" + part[0], False) + defaults[part] = datestr(now, "%" + part[0]) for format in formats: try: @@ -1636,7 +1638,8 @@ """ def lower(date): - return parsedate(date, extendeddateformats)[0] + d = dict(mb="1", d="1") + return parsedate(date, extendeddateformats, d)[0] def upper(date): d = dict(mb="12", HI="23", M="59", S="59")
--- a/tests/test-bundle-r.out Tue Mar 11 23:54:03 2008 +0100 +++ b/tests/test-bundle-r.out Tue Mar 11 16:04:25 2008 -0700 @@ -168,7 +168,7 @@ adding changesets transaction abort! rollback completed -abort: unknown parent ac69c658229d! +abort: 00changelog.i@ac69c658229d: unknown parent! % 2 2:d62976ca1e50 adding changesets
--- a/tests/test-diffdir.out Tue Mar 11 23:54:03 2008 +0100 +++ b/tests/test-diffdir.out Tue Mar 11 16:04:25 2008 -0700 @@ -18,5 +18,5 @@ +++ b/b @@ -0,0 +1,1 @@ +123 -abort: Ambiguous identifier! -abort: Ambiguous identifier! +abort: 00changelog.i@: ambiguous identifier! +abort: 00changelog.i@: ambiguous identifier!
--- a/tests/test-imerge.out Tue Mar 11 23:54:03 2008 +0100 +++ b/tests/test-imerge.out Tue Mar 11 16:04:25 2008 -0700 @@ -47,4 +47,4 @@ % nothing to merge abort: there is nothing to merge - use "hg update" instead % load unknown parent -abort: merge parent e6da4671640124fe5d3d70d2f54441d6cd76ae35 not in repository +abort: merge parent e6da46716401 not in repository