Merge with TAH
authorMatt Mackall <mpm@selenic.com>
Wed, 09 Nov 2005 13:42:16 -0800
changeset 1525 c85e5bbfd141
parent 1524 0d47bb884330 (diff)
parent 1520 95ee4f12fbd9 (current diff)
child 1526 c230939283c3
child 1536 b4ed825282fe
Merge with TAH
mercurial/commands.py
--- 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 <rev> -u -n -c] [files ...]::
+annotate [-r <rev> -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 <rev> -u -n -c] [files ...]
     -X, --exclude <pat>   exclude names matching the given patterns
     -r, --revision <rev>  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)
 
--- 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')),
--- 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
--- 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)