VCS Interfaces, round 3

Matthew Woehlke mw_triad at users.sourceforge.net
Fri May 4 16:03:24 UTC 2007


dukju ahn wrote:
>> class VcsMapping
>> {
>> public:
>>     enum MappingFlag
>>     {
>>         Recursive = 1,
>>         NonRecursive = 2
>>     };
>>     Q_DECLARE_FLAGS( MappingFlags, MappingFlag )
>>
>>     void addMapping( const KUrl& repositoryLocation,
>>                      const KUrl& localLocation,
>>                      MappingFlags recursion );
>>     void removeMapping( const KUrl& repositoryLocation);
>>     KUrl::List repositoryLocations();
>>     KUrl localLocation( const KUrl& repositoryLocation );
>>     MappingFlags mappingFlags( const KUrl& repositoryLocation ) const;
>> };
> 
> The mapping provides remote location-> local location, but where
> is local->remote conversion. I think local->remote conversion is needed.

Remember VcsMapping is used to specify mappings for e.g. checkout() and 
branch(). I don't think there is anything that /returns/ a VcsMapping 
(there could be in perforce, but I don't think there is generically; 
log() for example - which isn't limited to just copy actions - uses 
VcsItemEvent). So repositoryLocations() is just a convenience iterator, 
with localLocation() existing to get the other half of the data from the 
list.

IOW we have not provided any interface that allows you to ask a plugin 
to translate a repo path to a local path, if that's what you're 
thinking. In svn where mappings can be 1:N this isn't possible, anyway. 
(Perforce could provide such an interface, but IMO this should not be in 
a generic interface, or at least certainly not in IBasicVC.)

> For example, the caller want to invoke
> virtual VcsJob diff( const QVariant& localOrRepoLocationSrc,
>                         const QVariant& localOrRepoLocationDst,
>                         const Revision& srcRevision,
>                         const Revision& dstRevision,
>                         VcsDiffMode ) = 0;
> 
> then how the reposLocation Dst can be retrieved? If the qvariant
> is QString("/home/kdev/blah.c"), does it mean to fetch remote diff of given
> local file??

perforce sure seems to think that's valid. Hmm, ok, so that means giving 
a version other than WORKING (or for svn, BASE) means you want to diff 
against repositoryLocation(<file>) rather than <file> (assuming <file> 
is a local file). Makes sense to me... objections?

To answer your question (and also the one in your follow-up, and to try 
and clarify what Andreas said in his reply), a QString is always a repo 
path and a KUrl is always a local path. So unless "/home/kdev/blah.c" is 
a valid repo path, then what you have written above is invalid. :-)

Hmm, I understand where BASE comes from, but I am starting to think HAVE 
would be more obvious. Thoughts?

-- 
Matthew
Current geek index: 62%





More information about the KDevelop-devel mailing list