unison icon indicating copy to clipboard operation
unison copied to clipboard

feature: current branch shorthand in transcripts

Open aryairani opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe.

When I'm writing transcripts, typing .> at the start of each line was NBD, but typing scratch/main> at the start of each line is tedious and error-prone.

Describe the solution you'd like

  1. > defaults to the "current branch", which is scratch/main initially, but can be altered by other commands. the actual branch is shown in the output.md
  2. /branch or proj/branch> implicitly creates-empty and switches to /branch or proj/branch respectively; (this rule can be kept or we can get rid of it)
  3. > or /branch or project/branch> alone on a line is valid; the current branch or specified branch is shown in the output.md as well; (this is also optional, we could require explicit use of switch, but not clear why we would want to)

e.g.


Input:

```ucm
> ls
> branch.create foo
>
/bar>
other/other>
```

Output:

```ucm
scratch/main> ls
  
  nothing to show

scratch/main> branch.create foo

  Done. I've created the foo branch based off of main.
  
  Tip: To merge your work back into the main branch, first `switch /main` then `merge /foo`.

scratch/foo>
scratch/bar>
other/other>
```
  1. Currently we suppress the normal implicit branch creation output, but we could decide to include it in the output

Describe alternatives you've considered I considered typing it once and copy/pasting, but it's still annoying and also not really practical to dedicate the system clipboard to this purpose while editing transcripts.

Additional context

aryairani avatar Jul 05 '24 23:07 aryairani

I can try and see if Copilot is good enough. Result: it does sort of work, but is also annoying.

aryairani avatar Jul 06 '24 02:07 aryairani

There is some discussion (which I think probably should be linked to in Additional context) in #5173 in which @mitchellwrosen and I speculate that this short-hand wouldn't hold its weight.

ceedubs avatar Jul 08 '24 15:07 ceedubs

@ceedubs I don't understand if you have an opposition to the feature request? However, I apologize for cluttering/distracting the other ticket with it.

aryairani avatar Jul 10 '24 03:07 aryairani

@aryairani right I am slightly opposed. In addition to the reasons listed in the other ticket, I fear it could mask issues. Like imagine that there was a regression and branch.create stopped automatically switching you to the new branch. I think that it would be better for our transcripts to explicitly specify that a certain branch is expected than to use the current branch which might not be the one that we intend.

Maybe it would be fine and I could just avoid using the shorthand if I don't trust myself to use it responsibly. But to me the additional complexity and potential for mistakes doesn't seem worth the benefit.

ceedubs avatar Jul 10 '24 10:07 ceedubs

Ah okay. Just to clarify, the there's never been a way to test that branch.create automatically switches you to the new branch, just like there has never been a way to test that cd would actually switch you to the specified namespace, because the next "prompt" in the input transcript overrides the current branch/namespace.

By leaving the prompt unspecified in the input, this proposed shorthand feature would give us the ability to test that for the first time.

aryairani avatar Jul 10 '24 14:07 aryairani

@aryairani right I should clarify that I'm not comparing to the current state but to the proposal in #5173.

ceedubs avatar Jul 10 '24 15:07 ceedubs

I see, I had missed that.

aryairani avatar Jul 10 '24 15:07 aryairani