Closed Bug 1247322 Opened 10 years ago Closed 8 years ago

Expose "is ancestor" check

Categories

(Developer Services :: Mercurial: hg.mozilla.org, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ted, Assigned: gps)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

gps landed a change in Mercurial 3.4 that made /json-log work: https://selenic.com/hg/rev/0bf54479a9eb This doesn't seem to work on hg.mo, probably because our templates are out of sync: https://hg.mozilla.org/mozilla-central/json-log?rev=7042e8a19f94 (this should return a JSON blob, but it returns "not yet implemented").
Blocks: 511103
json-log is implemented but json-log?rev=X apprently goes through a slightly different template and isn't implemented. See https://selenic.com/hg/json-log?rev=0bf54479a9eb, which also displays "not yet implemented." I can likely deploy this on hg.mozilla.org as soon as the feature is implemented upstream (provided it doesn't require any Python changes), since template changes can occur any time. That being said, I worry that scanning log output isn't the best way to implement bug 511103. It seems like we want a special "are changesets in the same DAG head" endpoint. I'm not opposed to adding special endpoints to hg.mozilla.org when there is a need. See hgext/hgmo/__init__.py for some of the existing ones.
In bug 511101 comment 7 you suggested this approach. :) I'm happy to do whatever works, it just seemed like that was the right thing to do.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #2) > In bug 511101 comment 7 you suggested this approach. :) I'm happy to do > whatever works, it just seemed like that was the right thing to do. I didn't actually look at the source or web command documentation (https://hg.mozilla.org/mozilla-central/help/hgweb) yesterday. 1 year ago me was correct: we can pass a revset into that web command to perform a search. That is preferred to implementing a custom web command [which would almost certainly perform a revset under the hood].
I'm going to need this for the more intelligent automation scheduling I'm implementing in bug 1245953. See also the giant commit comment in bug 1247802 explaining where I'm going.
Assignee: nobody → gps
Blocks: 1245953
Status: NEW → ASSIGNED
Summary: Update hg.mozilla.org templates to pick up json template changes → JSON template for log search isn't implemented
This is not trivial. It is quicker to implement a custom web command on hg.mozilla.org.
Assignee: gps → nobody
No longer blocks: 1245953
Status: ASSIGNED → NEW
QA Contact: hwine → klibby
Came up today. Easy to implement. Patch forthcoming.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Summary: JSON template for log search isn't implemented → Expose "is ancestor" check
Comment on attachment 8882468 [details] hgmo: expose web command to test for ancestry (bug 1247322); https://reviewboard.mozilla.org/r/153594/#review160038 Thanks for doing this! ::: hgext/hgmo/__init__.py:524 (Diff revision 1) > + return tmpl('error', error={'error': "unknown node revision %s" % node}) > + > + testrev = testctx.rev() > + isancestor = False > + > + for rev in web.repo.changelog.ancestors([headctx.rev()], inclusive=True): Is there not a better way to do this query? You're the hg expert here, but I would have thought building a revset between the two revisions or something would be more efficient.
Attachment #8882468 - Flags: review?(ted) → review+
Comment on attachment 8882468 [details] hgmo: expose web command to test for ancestry (bug 1247322); https://reviewboard.mozilla.org/r/153594/#review160038 > Is there not a better way to do this query? You're the hg expert here, but I would have thought building a revset between the two revisions or something would be more efficient. It would be possible to do this with a revset, yes. But under the hood everything basically does what this code is doing. I don't think you can make it more efficient without a cache.
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/2a416d07254b hgmo: expose web command to test for ancestry ; r=ted
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: