In the olden days, to make a patch to a module, you had to have the original, untouched file and a copy that you modified. You'd then use diff
to compare the two files.
At the Pittsburgh Perl Workshop, Ricardo was asking how to do some odd thing in git. Instead of anyone answering his question, everyone asked what he was doing. It turns out he was patching someone's module and making it a git repo while he worked. The process is really handy:
git init
git add .
git commit -m "* Version 1.23 from CPAN"
git format-patch --stdout -1
A variation on step 6 and 7:
step 6. Generate patch with git format-patch -1
step 7. Send directly to the RT queue for the module, assuming that the first line of the commit description makes a good bug title and the rest a decent description: git send-email -to bug-Language-l33t@rt.cpan.org 0001-mypatch
. (one can also uses --compose
to write something different as the description as well)
step 8. Marty's your uncle as well.
with apologies to Miguel de Cervantes, Pierre Menard, Joe Darion, and Sophia Loren/Sheena Easton
the workflow with subversion would be the same, except the default output of 'svn diff' is usable by patch, so no special command needed.
I used the equivalent of svn diff | ( cd $newdir; patch) just the other day to propagate changes from a local svn tree to one built with https login & comit bit.
Re:go with git, or with subversion, it's all the s
brian_d_foy on 2008-10-15T21:13:22
How would you do this in Subversion without maintaining a repository? Maybe you can, but I just don't know how.
Re:go with git, or with subversion, it's all the s
n1vux on 2008-10-21T19:18:04
use someone else's repository?:-) a local repository of any sort
... even old sccs/rcs ... is always a good idea for hyper-meta-undo, if for nothing else. if git is better for that than svn, that's interesting news. see also answer to Aristotle's similar question.
Re:go with git, or with subversion, it's all the s
Aristotle on 2008-10-22T00:31:08
That is exactly what git (or any other DVCS for that matter) is so good for.
:-) In fact, that’s something I’ve said a couple of times – that DVCSs represent a backtracking to what local-only systems like RCS offered, and a move forward from there in the opposite direction for cross-host collaboration from the one that CVS and its offspring Subversion took. Instead of layering collaboration onto RCS by moving the repository out of a subdirectory of the working copy and behind a networked dæmon, they instead provide for reconciliation between many different copies of the repository. This turns out to be much more powerful.
Re:go with git, or with subversion, it's all the s
Aristotle on 2008-10-19T12:21:13
Subversion makes the mental overhead of creating a repository very much greater than any DVCS, where you just say
git init
orhg init
orbzr init
or whatever you prefer – there’s no need to pick a place for you repository, it just goes wherever your working copy is. There’s also no need to turn the current directory into a working copy after checking it in initially by checking it right back out, which may in turn require casting a path to a URL (sincesvnadmin
only works locally).It seems like small potatoes, but when you turn something that takes five commands and has a free variable into a single command that requires no thinking whatsoever, it changes the quality of the game. You start creating throw-away repositories for the littlest reason because the only decision left is whether to create one or not.
Re:go with git, or with subversion, it's all the s
n1vux on 2008-10-21T19:13:36
well, what i was patching has public read only repository, so i didn't have to create one. (it may be a bug or feature that creating a new one on googlecode takes mousing not commands.) I applied the diff-is-patch from my anonymous checkout with tested fixes in it to a new authenticated checkout with comit privs in addition to uploding the patch file, redundant i know.i see your point that if you have just a tarball of source, creating a local repository easily is good. Needing a cheat sheet for creating a local repositry would be a drag. Nothing that can't be scripted to a single cowmand though. and you can use the same repository in ~/svn for multiple projects if interleaving versions isn't going to be a problem for your security and compliance officer.
Re:go with git, or with subversion, it's all the s
Aristotle on 2008-10-22T00:22:25
Nothing that can’t be scripted to a single command though.
Sure, but you have to do it. Subversion does not (and by its nature as a centralised system cannot) provide a useful default for you, so everyone needs to establish their own convention and then script the sequence to their preferences. That’s obvious blinking twelve territory.