Closed Bug 1337946 Opened 7 years ago Closed 7 years ago

Expose pushlog revset predicates on hgweb

Categories

(Developer Services :: Mercurial: Pushlog, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: gps)

Details

Attachments

(2 files)

It'd be nice if we could use the pushlog revset predicates on the web interface.

Not all of them are implemented such that they're not easy to DOS, though, so it might need some care.

https://hg.mozilla.org/hgcustom/version-control-tools/file/tip/hgext/pushlog/__init__.py#l574 and friends is what I'm lookin at.
Restarting what was said in #hg...

revsets need to be marked as "safe" to allow them to be executed on the hgweb interface. The pushlog revsets aren't IIRC.

The pushlog revsets aren't exactly optimized. For example, pushdate() will fetch the entire pushlog database then iterate through and compare dates. It would be *really* nice if we could boil that down to a SQL query that only returned pushlog entries that matched the date expression. However, Mercurial's date expression is somewhat complicated and a function needs to be called to compare it against a time value. So I think the best we can do is run a SQL query to select all pushlog times, filter on that, then return data on changesets within.

It is possible the existing implementation is "good enough" - running locally on the server shows it to take a few hundred milliseconds to a few seconds. We already have revsets taking that long. As long as this isn't getting abused, I think it will be fine to enable as is.
Found this bug when writing a comment for bug 1370180. It is low hanging fruit. So I'll just implement it.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Comment on attachment 8875958 [details]
pushlog: optimize revision resolution (bug 1337946);

https://reviewboard.mozilla.org/r/147360/#review154268

::: hgext/pushlog/__init__.py:594
(Diff revision 1)
>      # involved. However, this is less overhead than issuing a SQL query for
>      # every changeset, especially on large repositories. There is room to make
>      # this optimal by batching SQL, but that adds complexity. For now,
>      # simplicity wins.
>      def getrevs():
> +        torev = repo.changelog.rev

for clarity please name this `to_rev`
Attachment #8875958 - Flags: review?(glob) → review+
Comment on attachment 8875957 [details]
pushlog: expose pushlog revsets to hgweb (bug 1337946);

https://reviewboard.mozilla.org/r/147358/#review154270
Attachment #8875957 - Flags: review?(glob) → review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/5bc8e4314613
pushlog: expose pushlog revsets to hgweb ; r=glob
https://hg.mozilla.org/hgcustom/version-control-tools/rev/3986d9ddbc08
pushlog: optimize revision resolution ; r=glob
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
FWIW, you can convert from bin node to rev even faster by going through repo.changelog.nodemap. I learned that from seeing a patch on the hg dev list authored after I submitted this review. It only buys us 20-30ms on 750ms. I don't think it is worth it at this juncture.
This is deployed. However, the revsets aren't working in the search box on hg.mozilla.org. I think this is a bug in the WSGI server not running extra code at extension load time that command dispatch does.
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/fd93826ec793
pushlog: work around Mercurial bug to expose revsets to hgweb
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: