Open Bug 1888222 Opened 2 years ago Updated 2 years ago

`--list-trains` shouldn't require a commit range

Categories

(Conduit :: moz-phab, defect, P3)

Tracking

(Not tracked)

People

(Reporter: glob, Unassigned)

References

(Blocks 1 open bug)

Details

Obtaining a list of possible trains currently requires viable commits to uplift; this is unexpected.

If possible it should just list all possible trains, instead of:

$ moz-phab uplift --list-trains
Failed to find draft commits to submit

or worse:

$ moz-phab uplift --list-trains
!! Found multiple upstreams (mozilla, try).
Determining the commit range using upstream "mozilla"
fatal: unknown commit mozilla
Determining the commit range using upstream "try"
fatal: unknown commit try
Unable to detect the start commit. Please provide its SHA-1 or
specify the upstream branch with `--upstream <branch>`.

I took a brief look at trying to fix this. It's happening because we re-use the command arguments from moz-phab submit in moz-phab uplift, and in moz-phab submit we use a default value for the start_rev argument. Then when we are building the Repository object from arguments, that value is set and by default we try to find a revision range.

I attempted to fix this by making --list-trains a mutually exclusive argument against a group containing all the other arguments for moz-phab uplift, however argparse doesn't support making a group of arguments mutually exclusive with another single argument. Alternative solutions:

  • Make the --list-trains argument a subcommand, like moz-phab uplift list-trains, so the parser detects it as a completely separate command and the default argument for start_rev is never set.
  • Decouple the moz-phab submit arguments from the code that detects the revision range in our Repository subclasses. This solution is more ideal but is also more work.
Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.