[Monotone-devel] any_path, bookkeeping_path, file_path

2008-09-01 Thread Stephen Leake
In specifying conflict resolutions, the user can specify a file that
contains the desired content.

I'd like to allow that file to either be in the workspace, or in the
bookkeeping area (or anywhere else, for that matter). That gives the
user maximum flexibility in designing a workflow.

However, I don't see how to do that nicely. There are two problems;
converting a std::string to an arbitrary path, and storing external
file names in basic-io format.

I'm just discovering this now, because all my tests so far have had
the user file in the workspace, but for the real Emacs DVC process, it
makes more sense to have it in the bookkeeping area.

First, I can store a std::string in the conflict resolution data. But
when it comes time to read that file, I had to do this:

  if (bookkeeping_path::external_string_is_bookkeeping_path
  (utf8(conflict.resolution.second)))
{
  bookkeeping_path p(conflict.resolution.second);
  read_data(p, result_raw_data);
}
  else
{
  file_path p(file_path_external(utf8(conflict.resolution.second)));
  read_data(p, result_raw_data);
}

because there is no way to construct an 'any_path' object from a
string.

Second, the basic-io format assumes internal representation of file
paths: push_file_pair outputs file_path.as_internal().

So I'm using push_str_pair instead, with the raw user-supplied file
name, and handling the conversion to any_path only when it's actually
needed, as above. I'm not sure that's acceptable.

-- 
-- Stephe


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] any_path, bookkeeping_path, file_path

2008-09-01 Thread Zack Weinberg
On Mon, Sep 1, 2008 at 12:06 PM, Stephen Leake
[EMAIL PROTECTED] wrote:
 In specifying conflict resolutions, the user can specify a file that
 contains the desired content.

 I'd like to allow that file to either be in the workspace, or in the
 bookkeeping area (or anywhere else, for that matter). That gives the
 user maximum flexibility in designing a workflow.

Did you try using a system_path?  That seems like a better fit for
what you're trying to do.

zw


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] any_path, bookkeeping_path, file_path

2008-09-01 Thread Stephen Leake
Zack Weinberg [EMAIL PROTECTED] writes:

 On Mon, Sep 1, 2008 at 12:06 PM, Stephen Leake
 [EMAIL PROTECTED] wrote:
 In specifying conflict resolutions, the user can specify a file that
 contains the desired content.

 I'd like to allow that file to either be in the workspace, or in the
 bookkeeping area (or anywhere else, for that matter). That gives the
 user maximum flexibility in designing a workflow.

 Did you try using a system_path?  

No, because I didn't know about them.

One of these days, I'll actually read _all_ of the current code :).

 That seems like a better fit for what you're trying to do.

As usual, I stumbled across system paths just before reading your
email.

Sorry for the noise.

-- 
-- Stephe


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel