monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] [PATCH] monotone ls authors


From: Bruce Stephens
Subject: [Monotone-devel] [PATCH] monotone ls authors
Date: Wed, 14 Dec 2005 12:53:11 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

This patch adds "monotone ls authors", which just lists the values of
author certs in a database.  

It feels like a command that you'd want if you were trying to complete
selectors in something like viewmtn, graphviz, or a shell.

# 
# old_revision [f3c6f108fc35c751b3bd7cc76e62e02d69fd60dc]
# 
# patch "commands.cc"
#  from [bb69d5346904d4e34109e3e78b4458b632a07161]
#    to [e584d8fd05dde6f5599d27e0a6b0f606d873a1ce]
# 
# patch "monotone.texi"
#  from [11687dcc11a586d90f591c8a91efb8ddb1028b82]
#    to [905d2ca04efe6767cf1f1d76b486cf6349214008]
# 
# patch "testsuite.at"
#  from [7eb046ec5e8c90996e72969051e77e2a9be82e0e]
#    to [a4f8ad60120d11aaf85cbf84f70ad71ad8707e7b]
# 
============================================================
--- commands.cc bb69d5346904d4e34109e3e78b4458b632a07161
+++ commands.cc e584d8fd05dde6f5599d27e0a6b0f606d873a1ce
@@ -1590,6 +1590,29 @@
     }
 }
 
+static void 
+ls_authors(string name, app_state & app, vector<utf8> const & args)
+{
+  vector< revision<cert> > certs;
+  app.db.get_revision_certs(author_cert_name, certs);
+
+  std::set< cert_value > authors;
+
+  for (vector< revision<cert> >::const_iterator i = certs.begin();
+       i != certs.end(); ++i)
+    {
+      cert_value name;
+      cert c = i->inner();
+      decode_base64(c.value, name);
+      authors.insert(name);
+    }
+  for (std::set< cert_value >::const_iterator i = authors.begin();
+       i != authors.end(); ++i)
+    {
+      cout << *i << endl;
+    }
+}
+
 static void
 ls_vars(string name, app_state & app, vector<utf8> const & args)
 {
@@ -1744,6 +1767,8 @@
     ls_keys(name, app, removed);
   else if (idx(args, 0)() == "branches")
     ls_branches(name, app, removed);
+  else if (idx(args, 0)() == "authors")
+    ls_authors(name, app, removed);
   else if (idx(args, 0)() == "epochs")
     ls_epochs(name, app, removed);
   else if (idx(args, 0)() == "tags")
============================================================
--- monotone.texi       11687dcc11a586d90f591c8a91efb8ddb1028b82
+++ monotone.texi       905d2ca04efe6767cf1f1d76b486cf6349214008
@@ -4076,6 +4076,10 @@
 If @var{pattern} is provided, it is used as a glob to limit the keys
 listed. Otherwise all keys in your database are listed.
 
address@hidden monotone list authors
+This command lists authors in the current database: that is, the
+values of author certificates.
+
 @item monotone list branches
 
 This command lists all known branches in your database.
@@ -7262,6 +7266,11 @@
 List all branches.
 @comment TROFF INPUT: .TP
 
address@hidden @b{list authors}
address@hidden @b{ls authors}
+List all authors.
address@hidden TROFF INPUT: .TP
+
 @item @b{list tags}
 @itemx @b{ls tags}
 List all tags.
============================================================
--- testsuite.at        7eb046ec5e8c90996e72969051e77e2a9be82e0e
+++ testsuite.at        a4f8ad60120d11aaf85cbf84f70ad71ad8707e7b
@@ -754,3 +754,4 @@
 m4_include(tests/t_update_switch_branch.at)
 m4_include(tests/t_mixed_case_pwd.at)
 m4_include(tests/t_read_privkey.at)
+m4_include(tests/t_ls_authors.at)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]