monotone-commits-diffs
[Top][All Lists]
Advanced

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

[Monotone-commits-diffs] net.venge.monotone: 05384f5da146ca691f35f19574b


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 05384f5da146ca691f35f19574b906b637d2c69a
Date: Sun, 8 Jul 2012 22:16:07 +0200 (CEST)

revision:            05384f5da146ca691f35f19574b906b637d2c69a
date:                2012-07-08T20:17:20
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone
changelog:
Improve performance of 'get_base_revision_id' automate command

The previous coding used 'workspace::get_parent_rosters' which calls
'get_work_rev' and ensures the parent revisions are actually in the
database; this has taken several seconds for some workspaces even with
a hot cache. By only calling 'get_work_rev' and not making sure the
revisions are in the database we can return instantly improving
performance (and battery life).

Whilst the safety of this function has decreased due to less verification,
it shouldn't cause too much harm as most other interactions with monotone
call 'get_parent_rosters' to verify the parents existence; e.g. 'mtn status'.

This was found due to the use of 'mtn au get_base_revision_id' being used
in automated build scripts for identification, and even builds with no
changes which used to return immediately would then take several seconds.

With this patch 'get_base_revision_id' has almost no cost allowing the
build system to return immediately.

manifest:
format_version "1"

new_manifest [84e696548443b2bad7b53df76ac94ddd687e8ac7]

old_revision [f6bdc2765a5efcf5944f1b59c7d10ba057ddd9b6]

patch "src/automate.cc"
 from [919e3df52514d0877aeafc67791aae6a3faa33b4]
   to [30e9bb3567e320f83ce5c1b4817dc9ad90fe8423]
============================================================
--- src/automate.cc	919e3df52514d0877aeafc67791aae6a3faa33b4
+++ src/automate.cc	30e9bb3567e320f83ce5c1b4817dc9ad90fe8423
@@ -1352,15 +1352,15 @@ CMD_AUTOMATE(get_base_revision_id, "",
   E(args.size() == 0, origin::user,
     F("no arguments needed"));
 
-  database db(app);
   workspace work(app);
+  revision_t rev;
 
-  parent_map parents;
-  work.get_parent_rosters(db, parents);
-  E(parents.size() == 1, origin::user,
+  work.get_work_rev(rev);
+
+  E(rev.edges.size() == 1, origin::user,
     F("this command can only be used in a single-parent workspace"));
 
-  output << parent_id(parents.begin()) << '\n';
+  output << rev.edges.begin()->first << '\n';
 }
 
 // Name: get_current_revision_id

reply via email to

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