chiark / gitweb /
Seamlessly allow diffs "from" the current working directory
authorChuck Lever <cel@netapp.com>
Tue, 15 Nov 2005 22:58:47 +0000 (17:58 -0500)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 17 Nov 2005 10:25:57 +0000 (10:25 +0000)
commitfcc1ad70be5ff89996358b6d770cd229fec2a3ba
tree8b13f0d3c44233d86e228d919399708bfd33dbc4
parent84bf626831d23aef519baee9a798e7ea3e8eaa52
Seamlessly allow diffs "from" the current working directory

Sometimes I get a big patch B (say it applies to a tree T) that I
want to split up into smaller patches P_1,...,P_n.  Say I've written
patches P_1 and P_2 so far. I'd like a quick way to generate a diff
between T + P_1 + P_2 and T + B, to see what's left to be done.

Currently I use a dirty trick that depends on editing backup files
directly.  If stg already stores trees with the results of applying the
currently unapplied patches, then a way to diff my working tree with one
of those would do the job.

OK, I wrote the above and then discovered:
stg diff -r patchname/top

Does what I want, except reversed.  OK, so stg diff is nifty.  I could
do it with the following patch that changes the empty string to refer to
the current working directory instead of the top of the last applied
patch.  Then

stg diff -r :patchname/top

gives what I want.  Since "/" is already available to refer to the top
of the last applied patch, it makes more sense to me to allow "" for the
current working directory anyway.

IE, there's no way to explicitly refer to the current working directory.
So the only way to get diffs with the current working directory is with a
-r argument that has no colon or trailing slash, in which case you get a
diff *to* the current working directory.

So my proposal gives you an explicit way to refer to the cwd--the empty
string, "".  That seems like a fairly symmetric way to do things, and it
takes advantage of the unused syntax ":patchname" which currently just
gives an error.

Signed-off-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Chuck Lever <cel@netapp.com>
stgit/commands/diff.py
stgit/git.py