monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] logging for UI improvement


From: William Uther
Subject: [Monotone-devel] logging for UI improvement
Date: Mon, 12 Mar 2007 20:01:34 +1100

Hi,
I figured the easiest way to gather data was to add a hook. Then people can install the hook or not as they choose.

The diff for the simple implementation is at the end of the email. Any objections to my committing it?

It can be used from lua like so:

function note_mtn_commandline(...)
        print(unpack(arg))
end

I assume you'd print all the commands to a log file somewhere and ask people to send it to you occasionally. A good hook might take some writing, but at least it is clear to end users what it does.

Be well,

Will       :-}

#
# old_revision [879c12d502bafeb14d1b09178d4a40503a91bb4b]
#
# patch "lua_hooks.cc"
#  from [7455b70dc877298e9c99d421a6f6e3a219ddfb3e]
#    to [a63c716a229b446316a6cd5bbe8cee917467db7e]
#
# patch "lua_hooks.hh"
#  from [3136f049c267df992198a278d5e71ee0ee687562]
#    to [4bb76263b566e0f1c65e5ef3b86f76a369f22350]
#
# patch "monotone.cc"
#  from [68b3ece2703bb23d90d2df357b7448ef32a01658]
#    to [ed40b55845e834dc8f12aab97fe8e210d1828ab6]
#
============================================================
--- lua_hooks.cc        7455b70dc877298e9c99d421a6f6e3a219ddfb3e
+++ lua_hooks.cc        a63c716a229b446316a6cd5bbe8cee917467db7e
@@ -918,7 +918,22 @@ lua_hooks::hook_note_netsync_end(size_t
     .ok();
}
+bool
+lua_hooks::hook_note_mtn(vector<string> const & args)
+{
+  Lua ll(st);
+  ll.func("note_mtn_commandline");
+
+  int n=0;
+ for (vector<string>::const_iterator i = args.begin(); i != args.end (); ++i, ++n)
+    ll.push_str(*i);
+
+  ll.call(n, 0);
+  return ll.ok();
+}
+
+
// Local Variables:
// mode: C++
// fill-column: 76
============================================================
--- lua_hooks.hh        3136f049c267df992198a278d5e71ee0ee687562
+++ lua_hooks.hh        4bb76263b566e0f1c65e5ef3b86f76a369f22350
@@ -147,6 +147,7 @@ public:
                              size_t certs_in, size_t certs_out,
                              size_t revs_in, size_t revs_out,
                              size_t keys_in, size_t keys_out);
+  bool hook_note_mtn(std::vector<std::string> const & args);
};
// Local Variables:
============================================================
--- monotone.cc 68b3ece2703bb23d90d2df357b7448ef32a01658
+++ monotone.cc ed40b55845e834dc8f12aab97fe8e210d1828ab6
@@ -246,6 +246,8 @@ cpp_main(int argc, char ** argv)
           if (!app.found_workspace && global_sanity.filename.empty())
global_sanity.filename = (app.opts.conf_dir / "dump").as_external();
+          app.lua.hook_note_mtn(args);
+
           // main options processed, now invoke the
           // sub-command w/ remaining args
           if (cmd.empty())






reply via email to

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