MER-C/wiki-java

getPageHistory(String title, Calendar start, Calendar end) is broken

Closed this issue · 6 comments

What steps will reproduce the problem?
1.
Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.add(Calendar.YEAR, -2);

        Revision []revs = m_wiki.getPageHistory("Участник:NirvanaBot/test/Портал/Н. статьи с шапкой и подвалом/Параметры", c1, c2);
2. getPageHistory(a, date1, date2) returns no revisions, must return 2 
revisions, 


What is the expected output? What do you see instead?

check for instance this url (2 revs = OK):
https://ru.wikipedia.org/w/api.php?maxlag=15&format=xml&action=query&prop=revisi
ons&rvlimit=max&titles=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%3ANirvan
aBot%2Ftest%2F%D0%9F%D0%BE%D1%80%D1%82%D0%B0%D0%BB%2F%D0%9D.+%D1%81%D1%82%D0%B0%
D1%82%D1%8C%D0%B8+%D1%81+%D1%88%D0%B0%D0%BF%D0%BA%D0%BE%D0%B9+%D0%B8+%D0%BF%D0%B
E%D0%B4%D0%B2%D0%B0%D0%BB%D0%BE%D0%BC%2F%D0%9F%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%
82%D1%80%D1%8B&rvprop=timestamp|user|ids|flags|size|comment

and this one (0 revs, must be 2):
https://ru.wikipedia.org/w/api.php?maxlag=15&format=xml&action=query&prop=revisi
ons&rvlimit=max&titles=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%3ANirvan
aBot%2Ftest%2F%D0%9F%D0%BE%D1%80%D1%82%D0%B0%D0%BB%2F%D0%9D.+%D1%81%D1%82%D0%B0%
D1%82%D1%8C%D0%B8+%D1%81+%D1%88%D0%B0%D0%BF%D0%BA%D0%BE%D0%B9+%D0%B8+%D0%BF%D0%B
E%D0%B4%D0%B2%D0%B0%D0%BB%D0%BE%D0%BC%2F%D0%9F%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%
82%D1%80%D1%8B&rvprop=timestamp|user|ids|flags|size|comment&rvend=20131130194831
&rvstart=20111130194831


What version of the product are you using? On what operating system?
r166

Please provide any additional information below.


Original issue reported on code.google.com by DimaTrof...@gmail.com on 30 Nov 2013 at 3:49

It seems that it works only when you set exact tamestamp of one of old 
revisions, not a random timestamp :(

Original comment by DimaTrof...@gmail.com on 1 Dec 2013 at 1:13

Goddamn fu@@@ng shit. Sorry!!!
I just confused rvstart and rvend, start vs end.
I thought it is natural order: start is start date (older), end is end date 
(newer), but it is inverse!!!!

So, what I want is to add a parameter rvdir= older/newer can we do that?

Original comment by DimaTrof...@gmail.com on 1 Dec 2013 at 1:23

// set continuation parameter
            if (line.contains("rvstartid=\""))
                rvstart = parseAttribute(line, "revstartid", 0);
            else
                rvstart = null;

not sure if this is correct,
when I call 
https://ru.wikipedia.org/w/api.php?maxlag=15&format=xml&action=query&prop=revisi
ons&rvlimit=max&titles=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%3ANirvan
aBot%2Ftest%2F%D0%9F%D0%BE%D1%80%D1%82%D0%B0%D0%BB%2F%D0%9D.+%D1%81%D1%82%D0%B0%
D1%82%D1%8C%D0%B8+%D1%81+%D1%88%D0%B0%D0%BF%D0%BA%D0%BE%D0%B9+%D0%B8+%D0%BF%D0%B
E%D0%B4%D0%B2%D0%B0%D0%BB%D0%BE%D0%BC%2F%D0%9F%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%
82%D1%80%D1%8B&rvprop=timestamp|user|ids|flags|size|comment&rvstart=201311301948
31&rvend=20111130194831&rvlimit=1
it adds 
<revisions rvcontinue="43509769"/>
no rvstartid

Original comment by DimaTrof...@gmail.com on 1 Dec 2013 at 1:46

> I thought it is natural order: start is start date (older), end is end date 
(newer), but it is inverse!!!!
(reads the API documenation) Wow. I'm sorely tempted to change the parameter 
order to have the earliest date first but that results in stealth breakage 
(i.e. without a compiler error). I suppose the boolean parameter will fix that.

Does r169 fix these problem?

Original comment by stop.squark on 2 Dec 2013 at 1:21

according to doc http://www.mediawiki.org/wiki/API:Properties#revisions_.2F_rv
"older" is default and this code: if (reverse) {url.append("&rvdir=older");} 
will not have any effect. Did you check this? (or is their doc wrong?)

I meant something like this:
if (reverse) {url.append("&rvdir=older");} else {url.append("&rvdir=newer");}


Original comment by DimaTrof...@gmail.com on 3 Dec 2013 at 6:38

This issue was closed by revision r170.

Original comment by stop.squark on 4 Dec 2013 at 8:50

  • Changed state: Fixed