* exporting the last N days of a repository
@ 2008-10-29 1:01 Geoff Russell
2008-10-29 15:10 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: Geoff Russell @ 2008-10-29 1:01 UTC (permalink / raw)
To: git
I want to export "the last N days" of a repository to create a copy
which has an origin which is
the state of the repository N days ago and has all the history between
then and now.
Can fast-export do this?
Cheers,
Geoff Russell
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-10-29 1:01 exporting the last N days of a repository Geoff Russell
@ 2008-10-29 15:10 ` Johannes Schindelin
2008-11-03 1:16 ` Geoff Russell
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2008-10-29 15:10 UTC (permalink / raw)
To: Geoff Russell; +Cc: git
Hi,
On Wed, 29 Oct 2008, Geoff Russell wrote:
> I want to export "the last N days" of a repository to create a copy
> which has an origin which is the state of the repository N days ago and
> has all the history between then and now.
>
> Can fast-export do this?
Yes. See the --since=... option.
Hth,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-10-29 15:10 ` Johannes Schindelin
@ 2008-11-03 1:16 ` Geoff Russell
2008-11-03 6:51 ` Johannes Schindelin
[not found] ` <cc29171c0811030855s2fb0d7a5ncdfdd6acd7c71537@mail.gmail.com>
0 siblings, 2 replies; 8+ messages in thread
From: Geoff Russell @ 2008-11-03 1:16 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
On Thu, Oct 30, 2008 at 1:40 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Wed, 29 Oct 2008, Geoff Russell wrote:
>
>> I want to export "the last N days" of a repository to create a copy
>> which has an origin which is the state of the repository N days ago and
>> has all the history between then and now.
>>
>> Can fast-export do this?
>
> Yes. See the --since=... option.
Sorry, I didn't explain what I want very well. N days ago I had a
working directory in
a state S with files F1,F2,F3,... I want to dump all the history
before then so that
this is my new starting point, so I want to keep all changes since
then. In general,
this is impossible if there are multiple branches which influence what
happens between
N and now, but in the simple non-branching case it should be possible.
Fast-export with From..To revisions (or with --since=...) just gives changes
since the point N days ago.
Basically I'm trying to do an "rcs -o:1.xyz" where xyz is
a version and I want to prune before that to shrink a large and unwanted
history.
Thanks,
Geoff Russell
>
> Hth,
> Dscho
>
>
--
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-11-03 1:16 ` Geoff Russell
@ 2008-11-03 6:51 ` Johannes Schindelin
[not found] ` <cc29171c0811030855s2fb0d7a5ncdfdd6acd7c71537@mail.gmail.com>
1 sibling, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2008-11-03 6:51 UTC (permalink / raw)
To: Geoff Russell; +Cc: git
Hi,
On Mon, 3 Nov 2008, Geoff Russell wrote:
> On Thu, Oct 30, 2008 at 1:40 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Wed, 29 Oct 2008, Geoff Russell wrote:
> >
> >> I want to export "the last N days" of a repository to create a copy
> >> which has an origin which is the state of the repository N days ago
> >> and has all the history between then and now.
> >>
> >> Can fast-export do this?
> >
> > Yes. See the --since=... option.
>
> Sorry, I didn't explain what I want very well. N days ago I had a
> working directory in a state S with files F1,F2,F3,... I want to dump
> all the history before then so that this is my new starting point, so I
> want to keep all changes since then.
Well, if you are interested in the history of your _local_ ref, then you
should use reflogs:
$ git log --since=HEAD@{10.days.ago}
Hth,
Dscho
P.S.: man git-reflog
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
[not found] ` <cc29171c0811030855s2fb0d7a5ncdfdd6acd7c71537@mail.gmail.com>
@ 2008-11-04 22:49 ` Geoff Russell
2008-11-05 0:18 ` Bob Hiestand
0 siblings, 1 reply; 8+ messages in thread
From: Geoff Russell @ 2008-11-04 22:49 UTC (permalink / raw)
To: git
Apologies to Johannes and Bob who have tried to help
but I'm still having difficulties, here is my current non-working script:
------------------------------------------------------------------
#!/bin/sh
DIR=/tmp/gitdemo
# for testing just arbitrarily
# select the 15th most recent commit as our new origin
NEWORIGIN=$(git rev-list master@{15} | head -1)
echo $NEWORIGIN
# checkout earlist point we are interested in
# we want to drop any history before this point
git checkout $NEWORIGIN
# now make a new directory, initialise with new origin
# and apply all commits after that point
mkdir $DIR && (cd $DIR ; git init) && \
rsync -aHv --exclude=.git ./ $DIR && \
(cd $DIR ; git add . ; git commit -m "starting point" </dev/null ) && \
git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )
----------------- end of script
The fast-import gives me a message I don't understand and doesn't
do the import.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-11-04 22:49 ` Geoff Russell
@ 2008-11-05 0:18 ` Bob Hiestand
2008-11-05 3:54 ` Geoff Russell
0 siblings, 1 reply; 8+ messages in thread
From: Bob Hiestand @ 2008-11-05 0:18 UTC (permalink / raw)
To: geoffrey.russell; +Cc: git, Johannes Schindelin
On Tue, Nov 4, 2008 at 4:49 PM, Geoff Russell
<geoffrey.russell@gmail.com> wrote:
> Apologies to Johannes and Bob who have tried to help
> but I'm still having difficulties, here is my current non-working script:
>
> ------------------------------------------------------------------
> #!/bin/sh
> DIR=/tmp/gitdemo
> # for testing just arbitrarily
> # select the 15th most recent commit as our new origin
> NEWORIGIN=$(git rev-list master@{15} | head -1)
> echo $NEWORIGIN
> # checkout earlist point we are interested in
> # we want to drop any history before this point
> git checkout $NEWORIGIN
> # now make a new directory, initialise with new origin
> # and apply all commits after that point
> mkdir $DIR && (cd $DIR ; git init) && \
> rsync -aHv --exclude=.git ./ $DIR && \
> (cd $DIR ; git add . ; git commit -m "starting point" </dev/null ) && \
> git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )
>
> ----------------- end of script
>
> The fast-import gives me a message I don't understand and doesn't
> do the import.
If I understood your requirement (I know nothing about fast-export),
it would look like this:
#!/bin/sh
DIR=/tmp/gitdemo
ORIGDIR=$PWD
git checkout -b shorthistory
NEWORIGIN=$(git rev-list --since='5 months ago' --reverse HEAD| head -1)
echo $NEWORIGIN
git filter-branch --parent-filter '
test $GIT_COMMIT = '$NEWORIGIN' &&
echo || cat' \
--tag-name-filter cat $NEWORIGIN^..
mkdir $DIR
cd $DIR
git init
git fetch $ORIGDIR shorthistory:master
Thank you,
bob
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-11-05 0:18 ` Bob Hiestand
@ 2008-11-05 3:54 ` Geoff Russell
2008-11-05 19:49 ` Bob Hiestand
0 siblings, 1 reply; 8+ messages in thread
From: Geoff Russell @ 2008-11-05 3:54 UTC (permalink / raw)
To: Bob Hiestand; +Cc: git, Johannes Schindelin
On Wed, Nov 5, 2008 at 10:48 AM, Bob Hiestand <bob.hiestand@gmail.com> wrote:
> On Tue, Nov 4, 2008 at 4:49 PM, Geoff Russell
> <geoffrey.russell@gmail.com> wrote:
>> Apologies to Johannes and Bob who have tried to help
>> but I'm still having difficulties, here is my current non-working script:
>>
>> ------------------------------------------------------------------
>> #!/bin/sh
>> DIR=/tmp/gitdemo
>> # for testing just arbitrarily
>> # select the 15th most recent commit as our new origin
>> NEWORIGIN=$(git rev-list master@{15} | head -1)
>> echo $NEWORIGIN
>> # checkout earlist point we are interested in
>> # we want to drop any history before this point
>> git checkout $NEWORIGIN
>> # now make a new directory, initialise with new origin
>> # and apply all commits after that point
>> mkdir $DIR && (cd $DIR ; git init) && \
>> rsync -aHv --exclude=.git ./ $DIR && \
>> (cd $DIR ; git add . ; git commit -m "starting point" </dev/null ) && \
>> git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )
>>
>> ----------------- end of script
>>
>> The fast-import gives me a message I don't understand and doesn't
>> do the import.
>
> If I understood your requirement (I know nothing about fast-export),
> it would look like this:
>
> #!/bin/sh
> DIR=/tmp/gitdemo
> ORIGDIR=$PWD
> git checkout -b shorthistory
> NEWORIGIN=$(git rev-list --since='5 months ago' --reverse HEAD| head -1)
> echo $NEWORIGIN
> git filter-branch --parent-filter '
> test $GIT_COMMIT = '$NEWORIGIN' &&
> echo || cat' \
> --tag-name-filter cat $NEWORIGIN^..
> mkdir $DIR
> cd $DIR
> git init
> git fetch $ORIGDIR shorthistory:master
Thanks Bob but when I ran your version (using master@{15} instead of
--since =...) it
effectively dropped the recent history, not the old history. Imagine a sequence
of 30 commits, no branches. I want to keep, for example, 15 through
30 and dump 1
to 15. So I need to have the working directory as at commit 15 and
then all the changes
to bring it up to 30.
... 11--12--13--14--15 ... 28--29--30
... Dump 1 to 15 keep 15 to 30.
Your script kept 1 to 15 and dumped the rest.
Cheers,
Geoff.
>
>
> Thank you,
>
> bob
>
--
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: exporting the last N days of a repository
2008-11-05 3:54 ` Geoff Russell
@ 2008-11-05 19:49 ` Bob Hiestand
0 siblings, 0 replies; 8+ messages in thread
From: Bob Hiestand @ 2008-11-05 19:49 UTC (permalink / raw)
To: geoffrey.russell; +Cc: git, Johannes Schindelin
On Tue, Nov 4, 2008 at 9:54 PM, Geoff Russell
<geoffrey.russell@gmail.com> wrote:
> Thanks Bob but when I ran your version (using master@{15} instead of
> --since =...) it
> effectively dropped the recent history, not the old history. Imagine a sequence
> of 30 commits, no branches. I want to keep, for example, 15 through
> 30 and dump 1
> to 15. So I need to have the working directory as at commit 15 and
> then all the changes
> to bring it up to 30.
>
> ... 11--12--13--14--15 ... 28--29--30
>
> ... Dump 1 to 15 keep 15 to 30.
>
> Your script kept 1 to 15 and dumped the rest.
I guess that's because you're using reflog syntax and pulling up a
commit that isn't on the current branch, due to rebasing, resetting,
or any such activity. Using the reflog syntax, for the few commits I
tried, produced the desired result.
I'm not sure why you'd use reflogs, however, as I believe the
--max-age or --since parameters to rev-list seem to be more in line
with your request. Actually, I'd be surprised if you couldn't
identify the one commit that you wanted to use and use it directly;
the rev-list was just to show an example.
Thank you,
bob
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-11-05 19:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 1:01 exporting the last N days of a repository Geoff Russell
2008-10-29 15:10 ` Johannes Schindelin
2008-11-03 1:16 ` Geoff Russell
2008-11-03 6:51 ` Johannes Schindelin
[not found] ` <cc29171c0811030855s2fb0d7a5ncdfdd6acd7c71537@mail.gmail.com>
2008-11-04 22:49 ` Geoff Russell
2008-11-05 0:18 ` Bob Hiestand
2008-11-05 3:54 ` Geoff Russell
2008-11-05 19:49 ` Bob Hiestand
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).