Skip to contentSkip to conversation

git-rev-tree

DISCUSSION Dave Jones 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

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

#1 lore raw
Quoted 2 lines · Dave Jones

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?

#2 lore raw
In reply to Dave Jones
Quoted 3 lines · Dave Jones

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.

Quoted 2 lines

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

author
#3 lore raw
Quoted 5 lines · Linus Torvalds

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.

Quoted 8 lines

- 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
[email protected]'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

#4 lore raw
Quoted 11 lines · Dave Jones
(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
[email protected]'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
Quoted 1 line

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.

Quoted 3 lines

*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

author
#5 lore raw
Quoted 14 lines · Linus Torvalds
Quoted 11 lines · Dave Jones
(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
[email protected]'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
Quoted 6 lines
Quoted 1 line

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