This can reduce unexpectedly pushing more than expected for users.
Details
Diff Detail
Event Timeline
llvm/utils/git-svn/git-llvm | ||
---|---|---|
107 | This does not work for me, if anyone can help? |
llvm/utils/git-svn/git-llvm | ||
---|---|---|
453 | Shouldn't the message be more descriptive? Maybe it should be "Multiple commits are about to be pushed. Are you sure?" The mailing list thread was specifically for newer contributors, right? I could imagine someone using git llvm push for the first time would imagine that was a normal message that is always given. | |
454 | Maybe "Did not proceed with pushing multiple commits" or at least "Aborting". Although I'm not sure any message is needed, probably just exiting is ok too. |
llvm/utils/git-svn/git-llvm | ||
---|---|---|
107 | Are you also getting a NameError? I'm not sure why this is (I don't know much about Python), but I can say that using raw_input works as expected. |
Change abort message to "Aborting"
llvm/utils/git-svn/git-llvm | ||
---|---|---|
107 | It works for me in the current version with python 2.7 and 3.7 on MacOS | |
453 | The output would be: Pushing 2 monorepo commits: 31a4e7393ea7 Ask confirmation when `git llvm push` will push multiple commits c5eb9c5e2018 dummy Are you sure? (y/n): |
llvm/utils/git-svn/git-llvm | ||
---|---|---|
116 | Maybe default to "no" (and indicate that with "(y/N)" in the query) when the user doesn't enter either one? |
+1 for defaulting to No.
As a follow-up patch, maybe the script could offer to squash the commits for you.
llvm/utils/git-svn/git-llvm | ||
---|---|---|
30 | I used read_input instead of input for the local variable name otherwise Python complains about using a variable before defining it, PTAL. | |
453 | Output is now: Pushing 2 monorepo commits: b28f3db64111 Fix `git llvm` script when no arguments are supplied on Python 3 aeef6550de82 Ask confirmation when `git llvm push` will push multiple commits Are you sure you want to create 2 commits? (y/N): |
llvm/utils/git-svn/git-llvm | ||
---|---|---|
30 | Yeah -- what I said would only work at the module level, because python variable binding semantics are different inside functions than outside. |
Instead of all the stuff with builtins, you can just do this:
and then below just call input().