mbt icon indicating copy to clipboard operation
mbt copied to clipboard

Add easier way to build last commit in current branch

Open sergey-ostapenko opened this issue 6 years ago • 3 comments

Can we add command that will build last commit in current branch? Like one of the following:

mbt build last mbt build commit last mbt build commit HEAD

Alternatively we can just resolve aliases like HEAD, HEAD^, HEAD~N in all execution scenarios.

sergey-ostapenko avatar May 11 '18 09:05 sergey-ostapenko

I think this is a great idea. It's similar to the experience with git. I guess HEAD^ and HEAD~N is more natural from that perspective.

buddhike avatar May 11 '18 14:05 buddhike

I think it's very simple to implement this. All git HEAD have a top commit that can be achieved by running git rev-parse HEAD. So the build commit can be reuse with --from and -- to when a HEAD commit SHA achieved.

saeid-ir avatar Nov 04 '18 13:11 saeid-ir

@buddyspike By CI perspective, it will miss building some targets in cases like

  • If multiple commits are merged, then HEAD^1 only build based on last commit changed targets and for HEAD^N, how can we figure out what is N in CI ,

I guess HEAD^ and HEAD~N is more natural from that perspective.

in this case, we can keep pointer file containing last successful mbt run commit sha and compare it with current e.g. mbt build diff --to $(git rev-parse HEAD) --from $(head -n1 pointer)

I think it's very simple to implement this. All git HEAD have a top commit that can be achieved by running git rev-parse HEAD. So the build commit can be reuse with --from and -- to when a HEAD commit SHA achieved.

works for me at least

pratikbin avatar Jun 19 '21 13:06 pratikbin