# HG changeset patch # User Matt Mackall # Date 1131572536 28800 # Node ID c85e5bbfd141ca56e840ebaf4499faa2c6ccf839 # Parent 0d47bb8843300d497297f4da04a4d426bb67dc00# Parent 95ee4f12fbd92b86595eff46fce68bfc47c45095 Merge with TAH diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -87,7 +87,7 @@ addremove [options] [files ...]:: New files are ignored if they match any of the patterns in .hgignore. As with add, these changes take effect at the next commit. -annotate [-r -u -n -c] [files ...]:: +annotate [-r -u -n -c -d] [files ...]:: List changes in files, showing the revision id responsible for each line This command is useful to discover who did a change or when a change took @@ -103,6 +103,7 @@ annotate [-r -u -n -c] [files ...] -X, --exclude exclude names matching the given patterns -r, --revision annotate the specified revision -u, --user list the author + -d, --date list the commit date -c, --changeset list the changeset -n, --number list the revision number (default) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -538,11 +538,20 @@ def annotate(ui, repo, *pats, **opts): cl = repo.changelog.read(repo.changelog.node(rev)) return trimuser(ui, cl[1], rev, ucache) + dcache = {} + def getdate(rev): + datestr = dcache.get(rev) + if datestr is None: + cl = repo.changelog.read(repo.changelog.node(rev)) + datestr = dcache[rev] = util.datestr(cl[2]) + return datestr + if not pats: raise util.Abort(_('at least one file name or pattern required')) - opmap = [['user', getname], ['number', str], ['changeset', getnode]] - if not opts['user'] and not opts['changeset']: + opmap = [['user', getname], ['number', str], ['changeset', getnode], + ['date', getdate]] + if not opts['user'] and not opts['changeset'] and not opts['date']: opts['number'] = 1 if opts['rev']: @@ -2140,6 +2149,7 @@ table = { [('r', 'rev', '', _('annotate the specified revision')), ('a', 'text', None, _('treat all files as text')), ('u', 'user', None, _('list the author')), + ('d', 'date', None, _('list the date')), ('n', 'number', None, _('list the revision number (default)')), ('c', 'changeset', None, _('list the changeset')), ('I', 'include', [], _('include names matching the given patterns')), diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -999,7 +999,10 @@ class hgwebdir: .replace("//", "/")) # update time with local timezone - d = (get_mtime(path), util.makedate()[1]) + try: + d = (get_mtime(path), util.makedate()[1]) + except OSError: + continue yield dict(contact=(get("ui", "username") or # preferred get("web", "contact") or # deprecated diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -387,6 +387,8 @@ def opener(base): except: pass raise fp.close() + st = os.lstat(f) + os.chmod(temp, st.st_mode) rename(temp, f) return file(f, mode)