FR: Jujutsu should be able to apply patches to files in a repo.
As Windows ships no patch utility by default, it would be nice to have something like it built into Jujutsu.
My idea for a basic outline of the command is:
jj patch applyequivalent togit amjj patch seriesfor integrating with the patch-series container format (cc @emilazy)
Multiple concerns were raised because jj patch seems to imply patch(1) behavior for multiple, I do not agree with it though.
Yuya also brought up -T email in another issue, which also may work for some use-cases, but that needs in my opinion some further discussion.
Alternative names: jj patch import and jj patch export.
Just a thought (don't give my suggestions more weight than others').
jj patch sounds like a command to apply patch. It would be nice if there's a word that's obviously a noun.
Would this be a subcommand for jj git?
jj patchsounds like a command to apply patch. It would be nice if there's a word that's obviously a noun.
I think when coming from Git, this might trip somebody up, but "patch" is both a noun and a verb in English. I don't see a problem with patch WRT parts of speech, just onboarding.
Would this be a subcommand for
jj git?
No, it is a top-level command as dealing with patches isn't really Git specific. E.g Googles custom backend also needs to deal with it.
jj patchsounds like a command to apply patch. It would be nice if there's a word that's obviously a noun.
I honestly don't see a problem here, as it encompasses all patch like functionality.
I honestly don't see a problem here, as it encompasses all
patchlike functionality.
It's nice if a subcommand namespace (= noun) isn't confusing with a command (= verb). That's the point. We already have jj tag, so I don't have a strong feeling about jj patch, though.
Git has git am and git format-patch and git imap-send and git send-email and git bundle.
Darcs has darcs apply and darcs rebase apply and darcs send.
Breezy has brz git-apply and brz send.
Mercurial has hg bundle (not sure about apply).
I forgot to mention SVN has a patch command.
I think when coming from Git, this might trip somebody up, but "patch" is both a noun and a verb in English. I don't see a problem with patch WRT parts of speech, just onboarding.
Personally, I think patch is fine as the namespace. The only actual Git command that has patch in the name is git format-patch, which is the noun rather than the verb.
Git has git am and git format-patch and git imap-send and git send-email and git bundle. Darcs has darcs apply and darcs rebase apply and darcs send. Breezy has brz git-apply and brz send. Mercurial has hg bundle (not sure about apply). I forgot to mention SVN has a patch command.
Thank for enumerating. I think it's pretty helpful to see what vocabulary other VCSes use.
- It's interesting that they're not namespaced in a regular fashion in any of those VCSes.
- Is
bzr git-applyt he way to import a patch in bzr? It seems like a weird analogue for the commandbzr send. - I personally think we should still namespace multiple commands under
jj patchor similar.
Is
bzr git-applyt he way to import a patch in bzr? It seems like a weird analogue for the commandbzr send.
Not bzr, which is Bazaar, but brz which is the modern fork Breezy which has the old Git compatibility plugin built-in. The help says
Apply a series of git-am style patches. This command will in the future probably be integrated into "bzr pull".
Not bzr, which is Bazaar, but brz
My mistake; I actually read brz but habitually typed bzr somehow.
Mercurial has
hg bundle(not sure about apply).
Note hg (un)bundle uses hg's binary format (which is similar to the wire protocol). The equivalent is hg import, which has hg patch as an alias.
As a CLI design principle (originally from Olivia Mackall), hg doesn't do namespaced commands.
Is there any other jj commands which could at least import patch files as a temporary workaround? (conflict resolution of jj applied on patch based workflow is pretty cool)
I think you can use git am, etc. or patch -p0 can be used in colocated Git/jj repo. You might have to jj new <patch-base-revision first to apply patches cleanly, then rebase the changes.
(conflict resolution of jj applied on patch based workflow is pretty cool)
This would be nice, but it only works if the patch has full context (-U1000000 should be sufficient in practice), or if we could find another commit where the patch applies cleanly.
it only works if the patch has full context
ehh… It would be totally fine to drop the changes context couldn't be found for into a .rej file like git am --reject does. I just want the "conflicts can be resolved later" workflow instead of git am's stop-the-world one!