An example of a visual diff program for Mercurial
Talin
talin at acm.org
Fri Nov 10 19:47:28 UTC 2006
Benoit Boissinot wrote:
> switching to mercurial-devel
>
> On 11/4/06, Talin <talin at acm.org> wrote:
>>
>> The problem is that the way that I am calling the Mercurial functions
>> now is a complete hack, arrived at mainly by guesswork -- I'm not
>> calling the top-level classes, because I don't know how to make them do
>> what I want - instead, I'm calling low-level subroutines directly. I'm
>> bypassing a whole lot of Mercurial setup code, for example, because I
>> have no idea how to make it work. I wasn't able to find any
>> documentation for calling Mercurial functions, other than the source
>> code comments.
>>
> Ok, i think the way to go for you is to build your app as a hg plugin
> (like 'hg view' or extdiff). That way all the setup will be
> automatically done for you.
>
> You really should look at hgext/extdiff.py and if you feel there is a
> lot of duplication we should add some helpers in mercurial/patch.py
OK, I understand the advantages of making the 'diff' program a plugin,
however that leads to another question.
Supposed I wanted to make a comprehensive GUI front-end for Mercurial
(No, I don't promise to do any such thing - I'm just interested). The
'diff' component would be a small part of this GUI.
As I envision it, such a GUI would have a 'main' window showing details
about the current repository - such as a list of all files, their
status, and so on. There would be various operations to commit files,
show differences, history, etc.
So far so good. However, one feature that you would want to have in such
a tool is the ability to switch repositories on the fly - in other
words, you don't want to have to close and re-open the program in order
to view a repository other than the current one.
However, if you write it as a plugin, that's pretty much what you would
have to do, if I understand correctly. The repository is set up before
the plugin is invoked - the plugin can't itself switch to a different
repository.
It seems to me that such a program would have to be a kind of weird
hybrid between plugin and non-plugin, and I'm not sure where you would
want to draw the line dividing them.
If anyone would like to give a brief sketch of how the architecture of
such a tool would look, I would be interested to hear it.
-- Talin
More information about the Mercurial-devel
mailing list