chaoss / grimoirelab-perceval

Send Sir Perceval on a quest to retrieve and gather data from software repositories.

Home Page:http://perceval.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backend for Gerrit not respecting --from-date

akshatmalik opened this issue · comments

Hi,

I have been trying to get the Gerrit backend working for a specific time period for OpenStack. However, I see that the --from-date parameter does not work as intended. The command I am using is perceval gerrit --user akshat --json-line -o dump_file3.json --max-reviews 10 --from-date '2011-09-20' 'review.openstack.org' and the input it returns is as follows:

    ],
    "createdOn": 1666733992,
    "hashtags": [],
    "id": "I6bb2e0822a51770b181181b49a86fb51d6dca18b",
    "lastUpdated": 1667939443,
    "number": 862646,
    "open": false,
    "owner": {
      "email": "li.zhu@windriver.com",
      "name": "Li Zhu",
      "username": "lzhu1"
    },
    "patchSets": [
      {
        "approvals": [
          {
            "by": {
              "name": "Zuul",
              "username": "zuul"
            },
            "description": "Verified",
            "grantedOn": 1666734503,
            "type": "Verified",
            "value": "-1"
          }
        ],
        "author": {
          "email": "li.zhu@windriver.com",
          "name": "Li Zhu",
          "username": "lzhu1"
        },
        "createdOn": 1666733992,
        "kind": "REWORK",
        "number": 1,
        "parents": [
          "03e953d8df762daf82356509ac71d85ff614de31"
        ],
        "ref": "refs/changes/46/862646/1",
        "revision": "aee20742e7ad684ed1c96f2efd49411333da88fc",
        "sizeDeletions": 34,
        "sizeInsertions": 94,
        "uploader": {
          "email": "li.zhu@windriver.com",
          "name": "Li Zhu",
          "username": "lzhu1"
        }
      },

As you can see the date created on is 1666733992 which is October 25, 2022 9:39:52 PM which is way off.

Is this issue valid or am I doing something wrong?

You are not doing anything wrong. Gerrit returns items from the newest to oldest. It's how gerrit works and there's no way to change that. When you set from-date with the backend, it will stop retrieving items when it finds an item that is oldest that from-date.

@sduenas Thank you for your response. I found that if I went to the UI and found the start for the segment I want, that could help me. However, that would mean modifying the scripts.

Maybe I can raise a PR with those changes.

Happy to have a PR with that feature too. Anything that can help to improve it, it's welcome. Take into account the backend doesn't use the Gerrit Rest API.

Closing this ticket as this is not a bug.