[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] [PATCH] Refactoring workspace API a bit
From: |
Nathaniel Smith |
Subject: |
[Monotone-devel] [PATCH] Refactoring workspace API a bit |
Date: |
Tue, 25 Sep 2007 17:45:10 -0700 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
I think the net.venge.monotone.work-rev-refactor branch is ready for
mainline. Would appreciate any comments, and also it totally changes
the internal _MTN/revision-related APIs, so people might want to take
note.
The full patch is ~60 kilobytes because there are lots of callsites
switched over to the new API. Not sending the full patch to the list,
but if anyone wants to see it:
mtn diff -r 133d7c3ff21229143d27ccd7cca5d64d2b117335 \
-r 3befc7cb6ed014757134d403ecf3618ec98e44d2
The important changes are in work.hh, and that part of the patch is
attached. Rationale: Currently, when we modify the workspace, we do
something like:
1) load the workspace roster (internally, this is done by loading
_MTN/revision, loading the parent roster(s), and applying the csets
in _MTN/revision to those roster(s).)
2) muck around with the workspace roster
3) load the parent roster(s)
4) use make_revision_for_workspace to calculate the differences from
the parent roster(s) to the new workspace roster, as a revision
5) write the revision to _MTN/revision with put_work_rev
This is inefficient (we load the parent roster(s) twice; often the
roster cache will handle this, but still), poorly factored (the whole
thing is open-coded all over the place instead of being encapsulated
somewhere), and also it interferes with my Secret Plan (which is only
secret at all because CIA is still down, but anyway).
In the modified API, put_work_rev has become a private function, and
get_current_roster_shape has (sort of) been removed. Instead we have
two functions that complement each other:
void get_work_state_shape_only(parent_map & parents,
roster_t & ros,
node_id_source & nis);
void set_work_state(parent_map const & parents,
roster_t const & new_roster);
The first is the same as the old get_current_roster_shape except that
it also returns the parent map; the second encapsulates steps
(4) and (5) above. Also there are a few other utilities like
set_work_state_to_new_root().
-- Nathaniel
--
"Of course, the entire effort is to put oneself
Outside the ordinary range
Of what are called statistics."
-- Stephan Spender
work-rev-refactor-partial-patch.diff
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-devel] [PATCH] Refactoring workspace API a bit,
Nathaniel Smith <=