Allow calling pushlog_client functions with tipsonly=False

RESOLVED FIXED

Status

Developer Services
Mercurial: hg.mozilla.org
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: armenzg, Assigned: MikeLing)

Tracking

Details

Attachments

(1 attachment)

55 bytes, text/x-github-pull-request
armenzg
: review+
Details | Review | Splinter Review
(Reporter)

Description

3 years ago
When calling query_pushes_by_revision_range [1], we define tipsonly=1 by default.

In this block
>    url = "%s?fromchange=%s&tochange=%s&version=%d&tipsonly=%d" % (
>       JSON_PUSHES % {"repo_url": repo_url},
>       from_revision,
>       to_revision,
>       version,
>       tipsonly
>   )
we should not assume that tipsonly is always specified.
This was introduced incorrectly by me [2]

The default value should be True (to keep backwards compatibility).
If True, we append &tipsonly=1, otherwise, we don't.
We also need to update the docstring.

We should also modify the Push class to indicate that *only* the tip changeset have been loaded [3].

For instance,
> pushes = query_pushes_by_revision_range(repo_url='https://hg.mozilla.org/try', from_revision='a29f3fd54de2', to_revision='a29f3fd54de2')
> print pushes
[<Push id:96174 info:{'date': 1446750429, 'changesets': [<changeset {'node': u'a1e682c00ff34c054a1217a8f057038cc8f8ffbb'}>], 'user': u'armenzg@mozilla.com'}>]

The push in that example is this one [4], however, the pushes object return does not make *any* mention of a29f3fd54de2. This is because a1e682c00ff3 is the tip most changeset and we have called tipsonly=1.

Hence, *all* pushes objects created with date from querying tipsonly=1 will *only* have information about the tip most changeset and not all other ones.

We should write a test for this as well.

Unfortunately, every call on pushlog_client has tipsonly=1 hard coded.

This has not caused any bugs on mozci because we *only* care about tipmost changesets for pushes, however, the current logic is incorrect.

We should mark a Push with a member to indicate that *only* tip most information has been provided when initialized.

A side note, version=2 should be changed for version=VERSION and create a constant at the top with VERSION=2.


[1] https://hg.mozilla.org/hgcustom/version-control-tools/file/default/pylib/mozhginfo/mozhginfo/pushlog_client.py#l34
[2] https://github.com/mozilla/mozilla_ci_tools/commit/78fcd9171b57c5e8b66f7ebdd0d30b1acb725d08#diff-878a4888cc4cc3c4abba3447e5afacedR28
[3] https://hg.mozilla.org/hgcustom/version-control-tools/file/default/pylib/mozhginfo/mozhginfo/pushlog_client.py#l61
[4] http://hg.mozilla.org/try/pushloghtml?changeset=a1e682c00ff34c054a1217a8f057038cc8f8ffbb
(Assignee)

Updated

3 years ago
Assignee: nobody → sabergeass
(Assignee)

Comment 1

3 years ago
Created attachment 8708677 [details] [review]
PR for bug 1238623

Hope it's good to go :)
Attachment #8708677 - Flags: review?(armenzg)
(Reporter)

Updated

3 years ago
Attachment #8708677 - Flags: review?(armenzg) → review+
(Reporter)

Comment 2

3 years ago
https://hg.mozilla.org/hgcustom/version-control-tools/rev/c502bfbcb17c2dd57362a69226d8c07708e56591
Bug 1238623 - Allow calling pushlog_client functions with tipsonly=False. r=armenzg
(Reporter)

Comment 3

3 years ago
Landed and released.
Thanks MikeLing!
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.