On VCS changes notifications

Andreas Pakulat apaku at gmx.de
Sun Mar 7 15:23:37 UTC 2010


On 06.03.10 19:39:28, Aleix Pol wrote:
> I was wondering about how could we know that the repository has changed in
> any way.
> 
> Here's some ideas, maybe we can find the proper solution for that:
> - Provide the vcs directory from the IBasicVCS class, something like "KUrl
> IBasicVCS::repositoryForUrl(const KUrl&);", that would mean expose too much
> information then we could have the KDirWatch who did that.

Can you elaborate a bit what "vcs directory" is and what you want to do
that?

> - Create a IBasicVCS signal called "void IBasicVCS::directoryChanged(const
> KUrl&)" that would tell us what changed when commiting/updating. we should
> connect to it when a project with this is added then just wait for
> notifications. Here we would have to hope the VCS plugin does that right but
> we could use it (and if implemented properly would work when it's
> commited/updated from the console).

Well, thats the best thing, we can even have separate signals
"comitFinished(const KUrl::List&)" and "directoryUpdated(const
KUrl::List&)". Additionally we'd probably should connect to a signal in
the documentcontroller thats triggered when a file is saved. The good
thing about having separate signals is that it might be easier to update
and fetch the status as the commitFinished() can have a list of only
those files that have really been comitted.

The repository-interface might also need some signal to notify
interested parties when the repository got a change, so that one can
display this in the project tree too (this one would probably rely on a
timer regularly fetching the information).

> - Add a "QList<KUrl> VcsJob::urls() const" method that would tell us what
> changed. Then we could listen to the IRunController and whenever some job is
> unregistered, we check if it's one of those we're interested on and we
> retrieve the info. It's a little unnatural but since the Vcs nature is so
> centered on paths, it could make sense. We wouldn't trigger the updates when
> the user commits/updates on the console, though.

I don't like this, as the vcs-plugins has no idea when the "changed
urls" list can be cleared. So the only option would be clearing it each
time after calling, which is a problem with multiple plugins want to do
something when a vcs-plugin did something.

Andreas

-- 
You'll wish that you had done some of the hard things when they were easier
to do.




More information about the KDevelop-devel mailing list