{"thread":{"id":"16074","subject":"exporting the last N days of a repository","startedAt":"2008-10-29T01:01:37Z","lastAt":"2008-11-05T19:49:31Z","messageCount":8,"participants":["Geoff Russell","Johannes Schindelin","Bob Hiestand"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94159","messageId":"93c3eada0810281801l29253e02g95c7a6851c4c4db3@mail.gmail.com","threadId":"16074","inReplyTo":null,"subject":"exporting the last N days of a repository","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2008-10-29T01:01:37Z","receivedAt":"2008-10-29T01:01:37Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"I want to export \"the last N days\" of a repository to create a copy\nwhich has an origin which is\nthe state of the repository N days ago and has all the history between\nthen and now.\n\nCan fast-export do this?\n\nCheers,\nGeoff Russell\n"},{"id":"94185","messageId":"alpine.DEB.1.00.0810291610340.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"16074","inReplyTo":"93c3eada0810281801l29253e02g95c7a6851c4c4db3@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-10-29T15:10:57Z","receivedAt":"2008-10-29T15:10:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 29 Oct 2008, Geoff Russell wrote:\n\n> I want to export \"the last N days\" of a repository to create a copy \n> which has an origin which is the state of the repository N days ago and \n> has all the history between then and now.\n> \n> Can fast-export do this?\n\nYes.  See the --since=... option.\n\nHth,\nDscho\n"},{"id":"94710","messageId":"93c3eada0811021716y37ba999fkc2085b1060fbea2d@mail.gmail.com","threadId":"16074","inReplyTo":"alpine.DEB.1.00.0810291610340.22125@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: exporting the last N days of a repository","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2008-11-03T01:16:52Z","receivedAt":"2008-11-03T01:16:52Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"On Thu, Oct 30, 2008 at 1:40 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Wed, 29 Oct 2008, Geoff Russell wrote:\n>\n>> I want to export \"the last N days\" of a repository to create a copy\n>> which has an origin which is the state of the repository N days ago and\n>> has all the history between then and now.\n>>\n>> Can fast-export do this?\n>\n> Yes.  See the --since=... option.\n\nSorry, I didn't explain what I want very well.  N days ago I had a\nworking directory in\na state S with files F1,F2,F3,...    I want to dump all the history\nbefore then so that\nthis is my new starting point, so I want to keep all changes since\nthen.  In general,\nthis is impossible if there are multiple branches which influence what\nhappens between\nN and now, but in the simple non-branching case it should be possible.\n\nFast-export with From..To revisions (or with --since=...) just gives changes\nsince the point N days ago.\n\nBasically I'm trying to do an \"rcs -o:1.xyz\" where xyz  is\na version and I want to prune before that to shrink a large and unwanted\nhistory.\n\nThanks,\nGeoff Russell\n\n\n\n>\n> Hth,\n> Dscho\n>\n>\n\n\n\n-- \n6 Fifth Ave,\nSt Morris, S.A. 5068\nAustralia\nPh: 041 8805 184 / 08 8332 5069\n"},{"id":"94720","messageId":"alpine.DEB.1.00.0811030749470.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"16074","inReplyTo":"93c3eada0811021716y37ba999fkc2085b1060fbea2d@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-03T06:51:29Z","receivedAt":"2008-11-03T06:51:29Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 3 Nov 2008, Geoff Russell wrote:\n\n> On Thu, Oct 30, 2008 at 1:40 AM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > On Wed, 29 Oct 2008, Geoff Russell wrote:\n> >\n> >> I want to export \"the last N days\" of a repository to create a copy \n> >> which has an origin which is the state of the repository N days ago \n> >> and has all the history between then and now.\n> >>\n> >> Can fast-export do this?\n> >\n> > Yes.  See the --since=... option.\n> \n> Sorry, I didn't explain what I want very well.  N days ago I had a \n> working directory in a state S with files F1,F2,F3,...  I want to dump \n> all the history before then so that this is my new starting point, so I \n> want to keep all changes since then.\n\nWell, if you are interested in the history of your _local_ ref, then you \nshould use reflogs:\n\n\t$ git log --since=HEAD@{10.days.ago}\n\nHth,\nDscho\n\nP.S.: man git-reflog\n"},{"id":"94926","messageId":"93c3eada0811041449u20e0fc74gf6a1cb420923e484@mail.gmail.com","threadId":"16074","inReplyTo":"cc29171c0811030855s2fb0d7a5ncdfdd6acd7c71537@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2008-11-04T22:49:33Z","receivedAt":"2008-11-04T22:49:33Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"Apologies to Johannes and Bob who have tried to help\nbut I'm still having difficulties, here is my current non-working script:\n\n------------------------------------------------------------------\n#!/bin/sh\nDIR=/tmp/gitdemo\n# for testing just arbitrarily\n# select the 15th most recent commit as our new origin\nNEWORIGIN=$(git rev-list master@{15} | head -1)\necho $NEWORIGIN\n# checkout earlist point we are interested in\n# we want to drop any history before this point\ngit checkout $NEWORIGIN\n# now make a new directory, initialise with new origin\n# and apply all commits after that point\nmkdir $DIR && (cd $DIR ; git init) &&  \\\n    rsync -aHv --exclude=.git ./ $DIR && \\\n    (cd $DIR ; git add . ; git commit -m \"starting point\" </dev/null ) && \\\n    git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )\n\n----------------- end of script\n\nThe fast-import gives me a message I don't understand and doesn't\ndo the import.\n"},{"id":"94942","messageId":"cc29171c0811041618jfbcb293l42a19805f06803a0@mail.gmail.com","threadId":"16074","inReplyTo":"93c3eada0811041449u20e0fc74gf6a1cb420923e484@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Bob Hiestand","fromEmail":"bob.hiestand@gmail.com","sentAt":"2008-11-05T00:18:23Z","receivedAt":"2008-11-05T00:18:23Z","isPatch":false,"sender":{"key":"bob.hiestand@gmail.com","avatar":null},"body":"On Tue, Nov 4, 2008 at 4:49 PM, Geoff Russell\n<geoffrey.russell@gmail.com> wrote:\n> Apologies to Johannes and Bob who have tried to help\n> but I'm still having difficulties, here is my current non-working script:\n>\n> ------------------------------------------------------------------\n> #!/bin/sh\n> DIR=/tmp/gitdemo\n> # for testing just arbitrarily\n> # select the 15th most recent commit as our new origin\n> NEWORIGIN=$(git rev-list master@{15} | head -1)\n> echo $NEWORIGIN\n> # checkout earlist point we are interested in\n> # we want to drop any history before this point\n> git checkout $NEWORIGIN\n> # now make a new directory, initialise with new origin\n> # and apply all commits after that point\n> mkdir $DIR && (cd $DIR ; git init) &&  \\\n>    rsync -aHv --exclude=.git ./ $DIR && \\\n>    (cd $DIR ; git add . ; git commit -m \"starting point\" </dev/null ) && \\\n>    git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )\n>\n> ----------------- end of script\n>\n> The fast-import gives me a message I don't understand and doesn't\n> do the import.\n\nIf I understood your requirement (I know nothing about fast-export),\nit would look like this:\n\n#!/bin/sh\nDIR=/tmp/gitdemo\nORIGDIR=$PWD\ngit checkout -b shorthistory\nNEWORIGIN=$(git rev-list --since='5 months ago' --reverse HEAD| head -1)\necho $NEWORIGIN\ngit filter-branch --parent-filter '\n        test $GIT_COMMIT = '$NEWORIGIN' &&\n        echo || cat' \\\n        --tag-name-filter cat $NEWORIGIN^..\nmkdir $DIR\ncd $DIR\ngit init\ngit fetch $ORIGDIR shorthistory:master\n\n\nThank you,\n\nbob\n"},{"id":"94956","messageId":"93c3eada0811041954i24a15e33tcdd89f50c162b8d2@mail.gmail.com","threadId":"16074","inReplyTo":"cc29171c0811041618jfbcb293l42a19805f06803a0@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2008-11-05T03:54:06Z","receivedAt":"2008-11-05T03:54:06Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"On Wed, Nov 5, 2008 at 10:48 AM, Bob Hiestand <bob.hiestand@gmail.com> wrote:\n> On Tue, Nov 4, 2008 at 4:49 PM, Geoff Russell\n> <geoffrey.russell@gmail.com> wrote:\n>> Apologies to Johannes and Bob who have tried to help\n>> but I'm still having difficulties, here is my current non-working script:\n>>\n>> ------------------------------------------------------------------\n>> #!/bin/sh\n>> DIR=/tmp/gitdemo\n>> # for testing just arbitrarily\n>> # select the 15th most recent commit as our new origin\n>> NEWORIGIN=$(git rev-list master@{15} | head -1)\n>> echo $NEWORIGIN\n>> # checkout earlist point we are interested in\n>> # we want to drop any history before this point\n>> git checkout $NEWORIGIN\n>> # now make a new directory, initialise with new origin\n>> # and apply all commits after that point\n>> mkdir $DIR && (cd $DIR ; git init) &&  \\\n>>    rsync -aHv --exclude=.git ./ $DIR && \\\n>>    (cd $DIR ; git add . ; git commit -m \"starting point\" </dev/null ) && \\\n>>    git fast-export $NEWORIGIN..master | (cd $DIR ; git fast-import )\n>>\n>> ----------------- end of script\n>>\n>> The fast-import gives me a message I don't understand and doesn't\n>> do the import.\n>\n> If I understood your requirement (I know nothing about fast-export),\n> it would look like this:\n>\n> #!/bin/sh\n> DIR=/tmp/gitdemo\n> ORIGDIR=$PWD\n> git checkout -b shorthistory\n> NEWORIGIN=$(git rev-list --since='5 months ago' --reverse HEAD| head -1)\n> echo $NEWORIGIN\n> git filter-branch --parent-filter '\n>        test $GIT_COMMIT = '$NEWORIGIN' &&\n>        echo || cat' \\\n>        --tag-name-filter cat $NEWORIGIN^..\n> mkdir $DIR\n> cd $DIR\n> git init\n> git fetch $ORIGDIR shorthistory:master\n\nThanks Bob but when I ran your version (using master@{15} instead of\n--since =...) it\neffectively dropped the recent history, not the old history. Imagine a sequence\nof 30 commits, no branches.  I want to keep, for example, 15 through\n30 and dump 1\nto 15.  So I need to have the working directory as at commit 15 and\nthen all the changes\nto bring it up to 30.\n\n       ... 11--12--13--14--15 ... 28--29--30\n\n       ... Dump 1 to 15           keep 15 to 30.\n\nYour script kept 1 to 15 and dumped the rest.\n\nCheers,\nGeoff.\n\n\n\n\n>\n>\n> Thank you,\n>\n> bob\n>\n\n\n\n-- \n6 Fifth Ave,\nSt Morris, S.A. 5068\nAustralia\nPh: 041 8805 184 / 08 8332 5069\n"},{"id":"94992","messageId":"cc29171c0811051149qaf8b980s37c53cd48c481ab4@mail.gmail.com","threadId":"16074","inReplyTo":"93c3eada0811041954i24a15e33tcdd89f50c162b8d2@mail.gmail.com","subject":"Re: exporting the last N days of a repository","fromName":"Bob Hiestand","fromEmail":"bob.hiestand@gmail.com","sentAt":"2008-11-05T19:49:31Z","receivedAt":"2008-11-05T19:49:31Z","isPatch":false,"sender":{"key":"bob.hiestand@gmail.com","avatar":null},"body":"On Tue, Nov 4, 2008 at 9:54 PM, Geoff Russell\n<geoffrey.russell@gmail.com> wrote:\n\n> Thanks Bob but when I ran your version (using master@{15} instead of\n> --since =...) it\n> effectively dropped the recent history, not the old history. Imagine a sequence\n> of 30 commits, no branches.  I want to keep, for example, 15 through\n> 30 and dump 1\n> to 15.  So I need to have the working directory as at commit 15 and\n> then all the changes\n> to bring it up to 30.\n>\n>       ... 11--12--13--14--15 ... 28--29--30\n>\n>       ... Dump 1 to 15           keep 15 to 30.\n>\n> Your script kept 1 to 15 and dumped the rest.\n\nI guess that's because you're using reflog syntax and pulling up a\ncommit that isn't on the current branch, due to rebasing, resetting,\nor any such activity.  Using the reflog syntax, for the few commits I\ntried, produced the desired result.\n\nI'm not sure why you'd use reflogs, however, as I believe the\n--max-age or --since parameters to rev-list seem to be more in line\nwith your request.  Actually, I'd be surprised if you couldn't\nidentify the one commit that you wanted to use and use it directly;\nthe rev-list was just to show an example.\n\nThank you,\n\nbob\n"}]}