Earlier the code was only looking for rulehashes and neglecting
all other revision identifiers, this code intercepts the fromrule function
and calls scmutil.revsingle() on anything that is not a rulehash and then
obtains the rulehash from the changectx object returned, rest of the pipeline
follows as it was
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHG3d3cff1f6bde: histedit: make histedit's commands accept revsets (issue5746)
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
What I did: @durin42 suggested in the issue page that the error was in the verify function of the histedit.py file. But when I ran through debugger using a revision number, the code was throwing the error before it reaches the verify function. Specifically in the fromrules function of the histedit.py file.
It was earlier only accepting rulehashes, I changed that to accept any revset using the scmutil.revsingle function suggested by @timeless on the IRC channel.
It'd be better if you could update the commit message with the necessary details that you mentioned in your previous comment.
Nice! I've got one suggested edit to the code that should still pass tests.
hgext/histedit.py | ||
---|---|---|
431–440 | I think you can replace this outer try with a revsingle call, something like this: try: ruleid = rule.strip().split(' ', 1)[0] _ctx = scmutil.revsingle(state.repo, ruleid) rulehash = _ctx.hex() rev = node.bin(rulehash) except error.RepoLookupError: |
@durin42 Even I thought of this construct before as it appears more elegant. But it is failing some tests!
Specifically, the error messages are changed in this one.
Failed test-histedit-arguments.t: output changed Failed test-histedit-edit.t: output changed # Ran 14 tests, 0 skipped, 2 failed. python hash seed: 3573457086
hgext/histedit.py | ||
---|---|---|
437 | This could be rev = scmutil.revsingle(...).node(). | |
438 | Note that error.LookupError may be raised if ruleid is odd-length and if it is an ambiguous hash. I think the error message would be still correct, though. | |
439 | _("invalid changeset %s") for translation. Can you send a followup? |
This could be rev = scmutil.revsingle(...).node().