VCS Interface classes
Jakob Petsovits
jpetso at gmx.at
Thu May 3 09:28:02 UTC 2007
On Monday, 30. April 2007, Andreas Pakulat wrote:
> I present to you our new VCS interface classes (that I finally managed
> to write up, based on the enourmus thread some time ago).
Btw, I had a short look on how MonoDevelop do their VCS stuff.
As one could expect, they are working with abstract classes instead of
interfaces, so they add a lot of default code into their template classes.
On the whole, their collection of abstract classes is a bit more complex than
our collection of interfaces, and of course they are naming a lot of stuff
quite differently. Their "basic VCS" code is in a class named Repository, so
they are organizing their version control stuff per repository, not per
plugin. They've also got a ChangeSet class, amongst others.
Specific stuff that could be interesting for us:
- The status enum, containing more possible states than ours:
public enum VersionStatus
{
Unversioned,
UnversionedIgnored,
Missing,
Obstructed,
Unchanged,
Protected,
Modified,
ScheduledAdd,
ScheduledDelete,
ScheduledReplace,
ScheduledIgnore,
Conflicted
}
- Instead of edit() and unedit(), they've got RequestFileWritePermission() and
NotifyFileChanged() which is called on saving the file. They've also got
Lock() and Unlock() together with CanLock() and CanUnlock().
No idea if one of them implies another one, or how those methods are supposed
to play together - at least, lock and unlock are nice method names.
- Overall, they've got a good amount of Can*(localPath) methods:
CanAdd(), CanUpdate(), CanCommit(), CanRemove(), CanRevert(),
CanLock() and CanUnlock().
- Move and Delete actions get an additional "bool force" parameter.
I think that one would come in handy for us as well, probably as an enum
instead of a bool.
Also, Move and Delete (but not Add) are split between files and directories,
and are always executed recursively (which actually makes a lot of sense).
- They've got a NotifyFileChanged( string path ):
// Called after a file has been modified.
// This method is always called for versioned and unversioned files.
Don't know whether that's necessary or not.
- Their DiffInfo class is a structure consisting of string fileName and
string content, where content is an actual unified diff, if I read that
correctly.
- Their Revision class contains a DateTime as only "revision name", and also
stores author and commit message as well as the Repository it belongs to, and
(optionally) a changedFiles array, the latter one consisting of string path,
commit action (enum with Add, Delete, Replace, Modify, Other) and
string actionDescription (??).
That's it for now (I think most important stuff is covered),
need to go for lunch :)
Have fun,
Jakob
More information about the KDevelop-devel
mailing list