threads / discuss / 2391

git-rev-tree

Subject: git-rev-tree

## tl;dr

6 messages between Nov 8, 2005 and Nov 8, 2005.

replies: 5people: 3as markdown or json

Dave Jones· Nov 8, 2005, 02:12 UTC · lore

Can someone remind me what the deprecated git-rev-tree command did, or how this should be fixed up to use newer git commands?

I'm trying to get git-changes-script working, but all the variants I've found on the web use this deprecated tool.

Any clues ?
		Dave
Linus Torvalds· Nov 8, 2005, 02:33 UTC · re: Dave Jones · lore

Re: git-rev-tree

On Mon, 7 Nov 2005, Dave Jones wrote:
>
> Can someone remind me what the deprecated git-rev-tree command did,
> or how this should be fixed up to use newer git commands?
It was basically the same as "git-rev-list", except:
 - it output the date (as a raw number) in front, so pretty much everybody 
   ended up using "cut" to remove it, sometimes after sorting the output 
   numerically.
   Sorting numerically is unnecessary with git-rev-list, since the output 
   is already sorted (not necessarily exactly by date, but by "recency" 
   and/or by other even stricter sorting rules)
 - it was limited to a certain number of heads maximum (I forget, but I 
   think it was 16).
 - it parsed the whole tree before outputting anything.
> I'm trying to get git-changes-script working, but all the
> variants I've found on the web use this deprecated tool.
The git-changes-script was pretty broken.
You're _much_ better off doing it by:
 - fetch the "remote" branch into the local repository. The 
   "git-changes-script" thing required that you fetch the remote branch 
   into _another_ repository, but still local. These days, just use a 
   local branch in the same repo.
   So, for example, tracking my tree
	export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
	git fetch $KERNEL/torvalds/linux-2.6 master:linus
   which will just fetch my "master" branch into the local "linus" branch.
 - then just do
	git log linus..HEAD
   and you'll see exactly what you wanted: what exists in your HEAD but 
   not in mine.
No complex script required.

Now, I've told some people that the diffstat is just the same (ie using a simple "git diff linus..HEAD | git-apply --stat") but that was because I've been muching some really awesomely bad 'shrooms. Clearly that doesn't work well at all, since it will show all the stuff I have in my branch reversed (since your head doesn't have it).

The way to get a diff is really to do a merge, and throw the merge away after creating the diff. Ie something like this should work:

	git checkout -b merge-branch
	git merge "dummy merge" master linus &&
		git-diff linus.. | git-apply --stat
	git checkout -f master
	git branch -D merge-branch

which will also tell you if the merge failed (in which case you might not want to send me a "please pull", but instead try the merge locally and fix it up, and then try again)

All of the above is obviously totally untested.
		Linus
Dave Jones· Nov 8, 2005, 02:57 UTC · re: Linus Torvalds · lore

Re: git-rev-tree

On Mon, Nov 07, 2005 at 06:33:30PM -0800, Linus Torvalds wrote:
 > 	export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
 > 	git fetch $KERNEL/torvalds/linux-2.6 master:linus
 > 
 >    which will just fetch my "master" branch into the local "linus" branch.
 > 
 >  - then just do
 > 
 > 	git log linus..HEAD
 > 
 >    and you'll see exactly what you wanted: what exists in your HEAD but 
 >    not in mine.
 > 
 > No complex script required.

Ok, I must be doing something totally bone-headed. Because this is what I tried to do before I headed down the path of making that script work.

Doing the above yields ...
(18:47:37:davej@hera:agp2)$ export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
(18:47:43:davej@hera:agp2)$ git fetch $KERNEL/torvalds/linux-2.6 master:linus
davej@master.kernel.org's password:
Packing 35335 objects
Unpacking 35335 objects
 100% (35335/35335) done
* committish: d27ba47e7e8c466c18983a1779d611f82d6a354f
  branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
* refs/heads/linus: storing branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
which looks ok, but then when I do the git log linus..HEAD, I get no output at all.

Whatever I'm doing wrong, I'm doing it consistently, as this happens in all my trees both locally, and on k.o

*click*, ahh wait, I didn't have a 'linus' branch before I did that fetch. For the above to work, do I need there to be a 'linus' branch before I start making changes ? Or am I barking up the wrong tree ?

		Dave
Linus Torvalds· Nov 8, 2005, 03:35 UTC · re: Dave Jones · lore

Re: git-rev-tree

On Mon, 7 Nov 2005, Dave Jones wrote:
Show 12 quoted lines
> 
> (18:47:37:davej@hera:agp2)$ export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
> (18:47:43:davej@hera:agp2)$ git fetch $KERNEL/torvalds/linux-2.6 master:linus
> davej@master.kernel.org's password:
> Packing 35335 objects
> Unpacking 35335 objects
>  100% (35335/35335) done
> * committish: d27ba47e7e8c466c18983a1779d611f82d6a354f
>   branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
> * refs/heads/linus: storing branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
> 
> which looks ok, but then when I do the git log linus..HEAD, I get no output at all.
You've got the right "linus" commit.

However, are you aware that I did pull from you? If you don't have anything new, "no output at all" is the right thing.

> *click*, ahh wait, I didn't have a 'linus' branch before I did that fetch.
> For the above to work, do I need there to be a 'linus' branch before
> I start making changes ?  Or am I barking up the wrong tree ?
No, the above will have created the "linus" branch as needed.
		Linus
Dave Jones· Nov 8, 2005, 03:43 UTC · re: Linus Torvalds · lore

Re: git-rev-tree

On Mon, Nov 07, 2005 at 07:35:55PM -0800, Linus Torvalds wrote:
 > 
 > 
 > On Mon, 7 Nov 2005, Dave Jones wrote:
 > > 
 > > (18:47:37:davej@hera:agp2)$ export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
 > > (18:47:43:davej@hera:agp2)$ git fetch $KERNEL/torvalds/linux-2.6 master:linus
 > > davej@master.kernel.org's password:
 > > Packing 35335 objects
 > > Unpacking 35335 objects
 > >  100% (35335/35335) done
 > > * committish: d27ba47e7e8c466c18983a1779d611f82d6a354f
 > >   branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
 > > * refs/heads/linus: storing branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git//torvalds/linux-2.6
 > > 
 > > which looks ok, but then when I do the git log linus..HEAD, I get no output at all.
 > 
 > You've got the right "linus" commit.
 > 
 > However, are you aware that I did pull from you? If you don't have 
 > anything new, "no output at all" is the right thing.

I only just saw my changes turn up on the commits list, so I was completely unaware until now. Hohum.

I'll figure it out next time I have something for you to pull again :)
thanks,
		Dave
Junio C Hamano· Nov 8, 2005, 04:55 UTC · re: Dave Jones · lore

Re: git-rev-tree

Dave Jones <davej@redhat.com> writes:
> Can someone remind me what the deprecated git-rev-tree command did,
> or how this should be fixed up to use newer git commands?

Alternatively, can somebody comment on the git-changes in the "pu" branch?

← back to recent threads