* How can I figure out what commits relate to a given diff?
@ 2008-05-22 15:21 Steven A. Falco
2008-05-22 15:48 ` Miklos Vajna
2008-05-22 16:04 ` Jeff King
0 siblings, 2 replies; 7+ messages in thread
From: Steven A. Falco @ 2008-05-22 15:21 UTC (permalink / raw)
To: git
I have a patch file, and I'd like to figure out which commits were used
to produce it.
For example, one of the diffs in the patch file begins with:
diff --git a/Makefile b/Makefile
index 9ceadaa..ad31bc6 100644
Is there a way to map a blob SHA1 to a commit? In this example, I'd
like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go
the other way, seeing what is in a commit, but I've not been able to
find a method for going "backwards" from a blob to a commit.
Thanks,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can I figure out what commits relate to a given diff?
2008-05-22 15:21 How can I figure out what commits relate to a given diff? Steven A. Falco
@ 2008-05-22 15:48 ` Miklos Vajna
2008-05-22 20:53 ` Steven A. Falco
2008-05-22 16:04 ` Jeff King
1 sibling, 1 reply; 7+ messages in thread
From: Miklos Vajna @ 2008-05-22 15:48 UTC (permalink / raw)
To: Steven A. Falco; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
On Thu, May 22, 2008 at 11:21:34AM -0400, "Steven A. Falco" <sfalco@harris.com> wrote:
> Is there a way to map a blob SHA1 to a commit? In this example, I'd
> like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go
> the other way, seeing what is in a commit, but I've not been able to
> find a method for going "backwards" from a blob to a commit.
Something like:
for i in `git rev-list HEAD`
do
git ls-tree -r $i|grep -q cb4e8ed && echo "$i contains cb4e8ed"
done
could do it for you.
I don't think there is a --contains for blobs, like git branch
--contains works for commits.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can I figure out what commits relate to a given diff?
2008-05-22 15:21 How can I figure out what commits relate to a given diff? Steven A. Falco
2008-05-22 15:48 ` Miklos Vajna
@ 2008-05-22 16:04 ` Jeff King
2008-05-23 10:07 ` perforce import: git-p4 memory usage, perforce import: git-p4 memory usage Luke Diamand
1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2008-05-22 16:04 UTC (permalink / raw)
To: Steven A. Falco; +Cc: git
On Thu, May 22, 2008 at 11:21:34AM -0400, Steven A. Falco wrote:
> For example, one of the diffs in the patch file begins with:
>
> diff --git a/Makefile b/Makefile
> index 9ceadaa..ad31bc6 100644
>
> Is there a way to map a blob SHA1 to a commit? In this example, I'd
> like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go
> the other way, seeing what is in a commit, but I've not been able to
> find a method for going "backwards" from a blob to a commit.
Miklos suggested a way of looking up trees and commits which contain
blobs, but you can also look for that specific change of blobs:
git log --pretty=format:'%h %s' --raw |
perl -00 -ne 'print if /9ceadaa.*ad31bc6/'
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can I figure out what commits relate to a given diff?
2008-05-22 15:48 ` Miklos Vajna
@ 2008-05-22 20:53 ` Steven A. Falco
0 siblings, 0 replies; 7+ messages in thread
From: Steven A. Falco @ 2008-05-22 20:53 UTC (permalink / raw)
To: Steven A. Falco, git
Miklos Vajna wrote:
> On Thu, May 22, 2008 at 11:21:34AM -0400, "Steven A. Falco" <sfalco@harris.com> wrote:
>> Is there a way to map a blob SHA1 to a commit? In this example, I'd
>> like to map 9ceadaa and ad31bc6 to their commits. It seems easy to go
>> the other way, seeing what is in a commit, but I've not been able to
>> find a method for going "backwards" from a blob to a commit.
>
> Something like:
>
> for i in `git rev-list HEAD`
> do
> git ls-tree -r $i|grep -q cb4e8ed && echo "$i contains cb4e8ed"
> done
>
> could do it for you.
>
> I don't think there is a --contains for blobs, like git branch
> --contains works for commits.
Thanks! It found the commit I needed.
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* perforce import: git-p4 memory usage, perforce import: git-p4 memory usage
2008-05-22 16:04 ` Jeff King
@ 2008-05-23 10:07 ` Luke Diamand
2008-05-23 11:25 ` Andreas Ericsson
2008-05-23 22:27 ` Logan Kennelly
0 siblings, 2 replies; 7+ messages in thread
From: Luke Diamand @ 2008-05-23 10:07 UTC (permalink / raw)
To: git, git@vger.kernel.org
Hi!
I'm trying to import part of a perforce repo with git-p4.
However, git-p4 appears to try to read all the repo into memory (and
moreover seems to need about twice as much memory as repo).
Once it runs out of swap, it dies (unsurprisingly).
I think it's failing in readP4Files(), where it appears to read the
entire repository in one go with "p4 -G -x - print".
Can I just rework this function to do stuff one file at a time? Or is
that dumb?
Thanks
Luke Diamand
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: perforce import: git-p4 memory usage
2008-05-23 10:07 ` perforce import: git-p4 memory usage, perforce import: git-p4 memory usage Luke Diamand
@ 2008-05-23 11:25 ` Andreas Ericsson
2008-05-23 22:27 ` Logan Kennelly
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Ericsson @ 2008-05-23 11:25 UTC (permalink / raw)
To: Luke Diamand; +Cc: git
Luke Diamand wrote:
> Hi!
>
> I'm trying to import part of a perforce repo with git-p4.
>
> However, git-p4 appears to try to read all the repo into memory (and
> moreover seems to need about twice as much memory as repo).
>
> Once it runs out of swap, it dies (unsurprisingly).
>
> I think it's failing in readP4Files(), where it appears to read the
> entire repository in one go with "p4 -G -x - print".
>
> Can I just rework this function to do stuff one file at a time? Or is
> that dumb?
>
It's probably a lot slower, and since git works with changesets it
probably won't work all that good unless you somehow construct some
middle-stage which you can then feed to git-fastimport or some such.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: perforce import: git-p4 memory usage
2008-05-23 10:07 ` perforce import: git-p4 memory usage, perforce import: git-p4 memory usage Luke Diamand
2008-05-23 11:25 ` Andreas Ericsson
@ 2008-05-23 22:27 ` Logan Kennelly
1 sibling, 0 replies; 7+ messages in thread
From: Logan Kennelly @ 2008-05-23 22:27 UTC (permalink / raw)
To: Luke Diamand; +Cc: git@vger.kernel.org
On May 23, 2008, at 3:07 AM, Luke Diamand wrote:
> However, git-p4 appears to try to read all the repo into memory (and
> moreover seems to need about twice as much memory as repo).
>
> Once it runs out of swap, it dies (unsurprisingly).
>
> I think it's failing in readP4Files(), where it appears to read the
> entire repository in one go with "p4 -G -x - print".
>
> Can I just rework this function to do stuff one file at a time? Or is
> that dumb?
I don't know if they were ever accepted into the mainline, but see the
series of patches submitted by Tommy Thorn.
http://article.gmane.org/gmane.comp.version-control.git/72342
--
Logan Kennelly
,,,
(. .)
--ooO-(_)-Ooo--
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-05-23 22:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 15:21 How can I figure out what commits relate to a given diff? Steven A. Falco
2008-05-22 15:48 ` Miklos Vajna
2008-05-22 20:53 ` Steven A. Falco
2008-05-22 16:04 ` Jeff King
2008-05-23 10:07 ` perforce import: git-p4 memory usage, perforce import: git-p4 memory usage Luke Diamand
2008-05-23 11:25 ` Andreas Ericsson
2008-05-23 22:27 ` Logan Kennelly
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).