[Yt-svn] commit/yt: MatthewTurk: Minor change to add the username to the inventory.json file

Bitbucket commits-noreply at bitbucket.org
Tue Mar 15 18:16:48 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/d892dcfe0ddd/
changeset:   r3845:d892dcfe0ddd
branch:      yt
user:        MatthewTurk
date:        2011-03-16 02:16:22
summary:     Minor change to add the username to the inventory.json file
affected #:  1 file (290 bytes)

--- a/yt/utilities/pasteboard.py	Tue Mar 15 17:59:57 2011 -0700
+++ b/yt/utilities/pasteboard.py	Tue Mar 15 18:16:22 2011 -0700
@@ -29,6 +29,10 @@
 
 from yt.config import ytcfg
 
+def _get_last_mod(filectx):
+    rev = filectx.filectx(filectx.filerev())
+    return rev
+
 class PostInventory(object):
     def __init__(self, uu = None, repo_fn = None):
         if uu is None: uu = ui.ui()
@@ -53,7 +57,7 @@
             if file.startswith("posts/") and file.count("/") == 1 \
                and not file.endswith(".desc"):
                 filectx = self.bbrepo["tip"][file]
-                last_mod = filectx.filectx(filectx.filerev()).date()
+                last_mod = _get_last_mod(filectx).date()
                 self.posts.append((last_mod[0] + last_mod[1], file))
         self.posts.sort()
         self.posts = self.posts[::-1]
@@ -98,14 +102,17 @@
             dfn = pfn + ".desc"
             if dfn in tip:
                 d = tip[dfn].data()
+                uname = _get_last_mod(tip[dfn]).user()
             elif pfn not in tip:
                 abs_pfn = os.path.join(self.repo_fn, pfn)
+                uname = self.uu.config("ui","username")
                 if os.path.exists(abs_pfn + ".desc"):
                     d = open(abs_pfn + ".desc").read()
                 else:
                     d = open(abs_pfn).read()
             else:
                 d = tip[pfn].data()
+                uname = _get_last_mod(tip[pfn]).user()
             if len(d) > 80: d = d[:77] + "..."
             name_noext = pfn[6:].replace(".","-")
             vals.append(dict(modified = time.ctime(t),
@@ -113,6 +120,7 @@
                              fullname = pfn,
                              htmlname = "html/%s.html" % name_noext,
                              name = pfn[43:], # 6 for posts/ then 36 for UUID
+                             username = uname,
                              descr = d)) 
         fn = os.path.join(self.repo_fn, "inventory.json")
         f = open(fn, "w")

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list