VcsRevision usage question.

dukju ahn dukjuahn at gmail.com
Wed Jun 6 16:28:18 UTC 2007


2007/6/6, Andreas Pakulat <apaku at gmx.de>:
> On 06.06.07 07:55:23, dukju ahn wrote:
> > 2007/6/5, Matthew Woehlke <mw_triad at users.sourceforge.net>:
> > > dukju ahn wrote:
> > > > I'm not discussing the interface. I'm asking the usages.
> > >
> > > Ok. These are good questions, btw, thanks for asking!
> > >
> > > > When revision is RevisionType::GlobalNumber, then does the
> > > > QString revisionValue() returns the number using QString::fromInt()??
> > >
> > > Sounds right, so you might have e.g. "651432" (that's a QString). Or...
> > > I wonder if we should standardize that between FileNumber and
> > > GlobalNumber, there is a specific prefix, e.g. GlobalNumber might always
> > > start with 'r' (or '@'?) and FileNumber might always start with '#'?
> >
> > Because we already know the type of revision by revisionType(),
> > we don't need to use special format to distinguish between filenumber
> > and globalnumber. Just int number will be enough
>
> No, not an int. Not all revision systems might use "plain integer"
> numbers, for example CVS has A.B.C.D.E.F.G.H... depending on the branch
> depth.
>
> > > > When revision is RevisionType::Date, then what is the format
> > > > of QString revisionValue() ?
> > >
> > > IIRC it should be a QDate-parsable string. We should probably specify a
> > > standard format (which may be 'use a system-configured format', but the
> > > point is we should be consistent across VCS's).
> >
> > Then we should use
> >
> > QString QDateTime::toString ( Qt::DateFormat format = Qt::TextDate ) const.
>
> You mean we should use Qt::TextDate as type? I object. This will be a
> localized string and IMHO we should rather strive to return UTC in a
> public API.

I overlooked. You are right.

> I'm actually wondering wether we should use QVariant as return type
> instead of QString, that way we can return a QDateTime directly. Of
> course any other type of revision will need to return a QString, even if
> for example its a revision number and the VCS uses plain ints for
> numbering.

IMHO, QVariant isn't needed. We already know the type of VcsRevision.
And QDateTime can be directly constructed using the returned QString.

> > > > Lastly, when revision is RevisionType::Special, what is the format of
> > > > QString revisionValue()? Is it just int? or string such as "Head"?
> > >
> > > It would be e.g. "HEAD", possibly all upper case like that. Again we
> > > should standardize this.
> >
> > Oh no. If RevisionType is Special, QString revisionValue() should return
> > the RevisionSpecialType enum value, which would be int.
>
> Wrong, it would be RevisionSpecialType, but if we do that and we do the
> above (which makes sense for me) then RevisionSpecialType needs to be
> registered as metatype.

Yes. it would be RevisionSpecialType. BTW, I don't understand what is
metatype. We already defined RevisionSpecialType. Why do we need
additional type?




More information about the KDevelop-devel mailing list