{"thread":{"id":"18809","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","startedAt":"2009-04-09T17:34:06Z","lastAt":"2009-04-11T19:29:15Z","messageCount":7,"participants":["Bert Wesarg","Ira Weiny","Uwe Kleine-König"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110935","messageId":"36ca99e90904091034m4d4d31dct78acb333612e678@mail.gmail.com","threadId":"18809","inReplyTo":"20090409124337.GA6034@pengutronix.de","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-04-09T17:34:06Z","receivedAt":"2009-04-09T17:34:06Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello Ira,\n>\n> On Wed, Apr 08, 2009 at 09:19:49AM -0700, Ira Weiny wrote:\n>> On Wed, 8 Apr 2009 10:39:55 +0200\n>> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n>>\n>> > Hello,\n>> >\n>> > On Wed, Apr 08, 2009 at 10:08:24AM +0200, Petr Baudis wrote:\n>> > > > I tried to update the tg-depend.txt but it was listed in the .gitignore?  I suspect that is because it is stored somewhere else?  I have attached a new version of that file as well.  (Sorry it is not in the patch.)\n>> > tg-$command.txt is created by spliting README.\n>>\n>> Cool, thanks.\n> You're welcome.  I'm glad you're sending patches.\n>\n>> > > > +       fi\n>> > > > +       TMPFILE=`mktemp` || exit 1\n>> > > > +       echo $TMPFILE\n>> > > > +       grep -v public-ibmad-port $root_dir/.topdeps > $TMPFILE\n>> > public-ibmad-port?\n>>\n>> Ok, I am pretty stupid for this one, sorry.\n> np\n>\n>> > > > +       mv $TMPFILE $root_dir/.topdeps\n>> > > > +else\n>> > > > +       echo \"$name\" >>\"$root_dir/.topdeps\"\n>> > > > +fi\n>> > > > +\n>> > > > +## commit it and update this branch\n>> > > >  git add -f \"$root_dir/.topdeps\"\n>> > > >  git commit -m\"New TopGit dependency: $name\"\n>> > > >  $tg update\n>> > > > --\n>> > > > 1.5.4.5\n>> > I don't think the patch is correct.  Just removing a branch from\n>> > .topdeps is not enough.\n>> >\n>> > Did you try to export the tg-branch?  The result will be that the patch\n>> > for that you deleted the dependency has the deleted change folded in.\n>>\n>> Indeed you are correct.  It was working for me because I was moving a node\n>> from one place to another.  But the new location was still an ancestor of the\n>> dependency which was removed.  I still think this can be automated but I will\n>> have to work on it.\n> So you mean that rm should only work if the patch is still a dependency?\n>\n> You might want to check\n>\n>        http://thread.gmane.org/gmane.comp.version-control.git/114581\n>\n> before investing time to implement it.  (I cc:d Bert Wesarg.)  If you\n> had posted to git@vger.kernel.org Bert might have seen your mail alone.\n> (hint hint)\nUwe,\n\nthanks for the Cc.\n\nI really can't reconstruct this thread, could some one send me the\noriginal patch. My interest is this, that I implemented a tg-prev\n(lists all deps from given topic), tg-next (lists topics depending on\nthe given topic), and a tg-tsort (which gives a topological list of\ndependencies, which is a little outdated after the --graphviz option)\n\nThe original message seems lost in the archive, the comments are still there:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/96483\n\nI can send an update on this.\n\nI think the first two commands could be added as sub-commands to\ntg-depend, with bash completion you don't need to type that much\nnowadays.\n\nAs I said to tg-tsort, its probably outdated because of the graphviz\noutput, but may still provide valid information.  Btw. does anyone\nknow a console output driver for the graphviz tools, i.e. dot and co?\n\nBert\n\n>\n> Best regards\n> Uwe\n\nPS: Finally added git list to Cc:\n"},{"id":"110942","messageId":"36ca99e90904091101l6dd1685y5be70dd77bf52b57@mail.gmail.com","threadId":"18809","inReplyTo":"20090409091021.5a7ded79.weiny2@llnl.gov","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-04-09T18:01:04Z","receivedAt":"2009-04-09T18:01:04Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2009/4/9 Ira Weiny <weiny2@llnl.gov>:\n> On Thu, 9 Apr 2009 14:43:37 +0200\n> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n>> You might want to check\n>>\n>>       http:// thread.gmane.org/gmane.comp.version-control.git/114581\n>\n> Ah this brings up more issues I had not thought about...  :-(  But perhaps\n> Bert's work could be used to help implement \"rm\".  Thoughts?\nNo, it wont help. Because the base and tip of the topic should not\nchanged in respect to the old state (expect for .topdeps of course).\n\nIf you really want to remove a dependency, you need to revert a merge\nof this dep from the topic base. which is not possible today, or maybe\nI have just an idea for this:\n\n  'topic': the topic\n  'base':  the base of the topic, i.e. a merge from all dependent\ntopics dep0, ..., depN\n\nsay you want to remove dep0\n\n  1) merge all deps dep1, ..,depN into 'new-base'\n\n  2) merge 'new-base' into base with the merge driver 'theirs', that\nwould overwrite all changes from dep0 in the 'base'\n\n  3) update 'topic' to the updated 'base'\n\nAny thoughts from someone who knows more than me?\n\nBert\n\n> Thanks,\n> Ira\n"},{"id":"110944","messageId":"20090409111838.c79d532f.weiny2@llnl.gov","threadId":"18809","inReplyTo":"36ca99e90904091034m4d4d31dct78acb333612e678@mail.gmail.com","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Ira Weiny","fromEmail":"weiny2@llnl.gov","sentAt":"2009-04-09T18:18:38Z","receivedAt":"2009-04-09T18:18:38Z","isPatch":true,"sender":{"key":"weiny2@llnl.gov","avatar":null},"body":"On Thu, 9 Apr 2009 19:34:06 +0200\nBert Wesarg <bert.wesarg@googlemail.com> wrote:\n\n> 2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> > Hello Ira,\n> >\n> > On Wed, Apr 08, 2009 at 09:19:49AM -0700, Ira Weiny wrote:\n> >> On Wed, 8 Apr 2009 10:39:55 +0200\n> >> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n> >>\n\n[snip]\n\n> >> > > > +       mv $TMPFILE $root_dir/.topdeps\n> >> > > > +else\n> >> > > > +       echo \"$name\" >>\"$root_dir/.topdeps\"\n> >> > > > +fi\n> >> > > > +\n> >> > > > +## commit it and update this branch\n> >> > > >  git add -f \"$root_dir/.topdeps\"\n> >> > > >  git commit -m\"New TopGit dependency: $name\"\n> >> > > >  $tg update\n> >> > > > --\n> >> > > > 1.5.4.5\n> >> > I don't think the patch is correct.  Just removing a branch from\n> >> > .topdeps is not enough.\n> >> >\n> >> > Did you try to export the tg-branch?  The result will be that the patch\n> >> > for that you deleted the dependency has the deleted change folded in.\n> >>\n> >> Indeed you are correct.  It was working for me because I was moving a node\n> >> from one place to another.  But the new location was still an ancestor of the\n> >> dependency which was removed.  I still think this can be automated but I will\n> >> have to work on it.\n> > So you mean that rm should only work if the patch is still a dependency?\n> >\n> > You might want to check\n> >\n> >        http:// thread.gmane.org/gmane.comp.version-control.git/114581\n> >\n> > before investing time to implement it.  (I cc:d Bert Wesarg.)  If you\n> > had posted to git@vger.kernel.org Bert might have seen your mail alone.\n> > (hint hint)\n> Uwe,\n> \n> thanks for the Cc.\n> \n> I really can't reconstruct this thread, could some one send me the\n> original patch.\n\nI have attached the original patch (cleaned up with Uwe's original comments).\n\nNOTE: this will not work but I am just sending it to help reconstruct the\nthread.\n\nI think to do this properly you would have to either A) create a new branch\nwithout the topic specified B) work your way back through the dependencies and\nreverse patch all those nodes which do not have a common ancestor with any of\nyour other dependencies.  As an aside I found that topgit does not like you\nremoving the only dependency left.  I was unable to get that to work at all.\nI don't know why.\n\nI believe you specified option A in a message after this one, correct?\n\nIra\n\n>\n> My interest is this, that I implemented a tg-prev\n> (lists all deps from given topic), tg-next (lists topics depending on\n> the given topic), and a tg-tsort (which gives a topological list of\n> dependencies, which is a little outdated after the --graphviz option)\n> \n> The original message seems lost in the archive, the comments are still there:\n> \n> http:// thread.gmane.org/gmane.comp.version-control.git/96483\n> \n> I can send an update on this.\n> \n> I think the first two commands could be added as sub-commands to\n> tg-depend, with bash completion you don't need to type that much\n> nowadays.\n> \n> As I said to tg-tsort, its probably outdated because of the graphviz\n> output, but may still provide valid information.  Btw. does anyone\n> know a console output driver for the graphviz tools, i.e. dot and co?\n> \n> Bert\n> \n> >\n> > Best regards\n> > Uwe\n> \n> PS: Finally added git list to Cc:\n> \n\n\n-- \nIra Weiny\nMath Programmer/Computer Scientist\nLawrence Livermore National Lab\nweiny2@llnl.gov\n\n\nFrom 3a424a1887a815ca742ef4bacec09b245658b1b7 Mon Sep 17 00:00:00 2001\nFrom: Ira Weiny <weiny2@llnl.gov>\nDate: Tue, 7 Apr 2009 13:03:48 -0700\nSubject: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend\n\n\nSigned-off-by: Ira Weiny <weiny2@llnl.gov>\n---\n README       |   16 +++++++++++++---\n tg-depend.sh |   27 +++++++++++++++++++++++++--\n 2 files changed, 38 insertions(+), 5 deletions(-)\n\ndiff --git a/README b/README\nindex d2f095d..8b4356d 100644\n--- a/README\n+++ b/README\n@@ -256,8 +256,13 @@ tg delete\n tg depend\n ~~~~~~~~~\n \tChange dependencies of a TopGit-controlled topic branch.\n-\tThis should have several subcommands, but only 'add' is\n-\tsupported right now.\n+\tThis command has the subcommands:\n+\t\t'list'  <== Default (run when no subcommand is given)\n+\t\t'add'\n+\t\t'rm'\n+\n+\t'list' lists the topic branches on which the current topic branch\n+\tdepends.\n \n \tThe 'add' subcommand takes an argument of a topic branch\n \tto be added, adds it to '.topdeps', performs a commit and\n@@ -266,7 +271,12 @@ tg depend\n \tadjusting '.topmsg', prepare them in the index before\n \tcalling 'tg depend add'.\n \n-\tTODO: Subcommand for removing dependencies, obviously\n+\tThe 'rm' subcommand takes an argument of a topic branch\n+\tto be removed, removes it from '.topdeps', performs a commit and\n+\tthen updates your topic branch accordingly. If you want to\n+\tdo other things related to the dependency addition, like\n+\tadjusting '.topmsg', prepare them in the index before\n+\tcalling 'tg depend rm'.\n \n tg info\n ~~~~~~~\ndiff --git a/tg-depend.sh b/tg-depend.sh\nindex ef5f94f..6a4bc85 100644\n--- a/tg-depend.sh\n+++ b/tg-depend.sh\n@@ -4,16 +4,25 @@\n # GPLv2\n \n name=\n+mode=\n \n \n ## Parse options\n \n subcmd=\"$1\"; shift || :\n case \"$subcmd\" in\n-\t-h|\"\")\n+\t-h)\n \t\techo \"Usage: tg [...] depend add NAME\" >&2\n \t\texit 1;;\n \tadd)\n+\t\tmode=\"add\"\n+\t\t;;\n+\t\"\"|list)\n+\t\tcat $root_dir/.topdeps\n+\t\texit 0\n+\t\t;;\n+\trm)\n+\t\tmode=\"rm\"\n \t\t;;\n \t*)\n \t\tdie \"unknown subcommand ($subcmd)\";;\n@@ -43,7 +52,21 @@ baserev=\"$(git rev-parse --verify \"refs/top-bases/$name\" 2>/dev/null)\" ||\n \n ## Record new dependency\n \n-echo \"$name\" >>\"$root_dir/.topdeps\"\n+if [ \"$mode\" = \"rm\" ]; then\n+\tgrep $name $root_dir/.topdeps > /dev/null\n+\tif [ \"$?\" != \"0\" ]; then\n+\t\techo \"Failed to find $name in dependency list\"\n+\t\texit 1\n+\tfi\n+\tTMPFILE=`mktemp` || exit 1\n+\techo $TMPFILE\n+\tgrep -v $name $root_dir/.topdeps > $TMPFILE\n+\tmv $TMPFILE $root_dir/.topdeps\n+else\n+\techo \"$name\" >>\"$root_dir/.topdeps\"\n+fi\n+\n+## commit it and update this branch\n git add -f \"$root_dir/.topdeps\"\n git commit -m\"New TopGit dependency: $name\"\n $tg update\n-- \n1.5.4.5\n\n"},{"id":"110954","messageId":"20090409201515.GA4218@pengutronix.de","threadId":"18809","inReplyTo":"36ca99e90904091101l6dd1685y5be70dd77bf52b57@mail.gmail.com","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-04-09T20:15:15Z","receivedAt":"2009-04-09T20:15:15Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nOn Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:\n> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:\n> > On Thu, 9 Apr 2009 14:43:37 +0200\n> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n> >> You might want to check\n> >>\n> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581\n> >\n> > Ah this brings up more issues I had not thought about...  :-(  But perhaps\n> > Bert's work could be used to help implement \"rm\".  Thoughts?\n> No, it wont help. Because the base and tip of the topic should not\n> changed in respect to the old state (expect for .topdeps of course).\n> \n> If you really want to remove a dependency, you need to revert a merge\n> of this dep from the topic base. which is not possible today, or maybe\n> I have just an idea for this:\n> \n>   'topic': the topic\n>   'base':  the base of the topic, i.e. a merge from all dependent\n> topics dep0, ..., depN\n> \n> say you want to remove dep0\n> \n>   1) merge all deps dep1, ..,depN into 'new-base'\n> \n>   2) merge 'new-base' into base with the merge driver 'theirs', that\n> would overwrite all changes from dep0 in the 'base'\n> \n>   3) update 'topic' to the updated 'base'\n> \n> Any thoughts from someone who knows more than me?\nSome time ago I thought about a similar issue:\n\nI based a branch on top of the Linux tree of the ARM maintainer (in the\nfollowing called \"rmk\") and decided later to base it on top of Linus'\ntree.  So I did ~:\n\n\tgit checkout refs/top-bases/$branch\n\tgit merge -s theirs linus/master\n\tgit checkout $branch\n\tsed -i s,rmk,linus, .topdeps\n\tgit add -f .topdeps\n\tgit commit -m $commitmsg\n\ttg update\n\nWhen I thought about it with pencil and paper back then, I saw a problem\nwith that approach.  Now I invested some time now to verify it really\nexists:  In fact I reverted the changes in the rmk/master branch.\nConsider Linus pulls from rmk and I update my topgit branch.  Guess what\nhappens?  Linus' pull + my revert yield Linus' tree without rmk's\nchanges.\n\nHere is my recipe:\n\n\t# prepare linus/master\n\tgit init\n\techo 'VERSION=2.6.28' > Makefile\n\tgit add Makefile; git commit -m 'v2.6.28'\n\tgit branch -m master linus/master\n\n\t# prepare rmk/master\n\tgit checkout -b rmk/master\n\techo 'support for some machine' > arm.c\n\tgit add arm.c; git commit -m 'support for some machine'\n\n\t# new topgit branch\n\ttg create t/test\n\techo change > lib.c\n\tgit add lib.c; git commit -m 'tralala'\n\n\t# Linus goes on ...\n\tgit checkout linus/master\n\techo 'VERSION=2.6.29-rc1' > Makefile\n\tgit add Makefile; git commit -m 'v2.6.29-rc1'\n\n\t# \"rebase\" test branch on linus/master\n\tgit checkout refs/top-bases/t/test\n\tgit symbolic-ref HEAD refs/top-bases/t/test\n\tgit merge --no-commit linus/master\n\tgit read-tree linus/master\n\tgit commit\n\trm arm.c\n\tgit checkout t/test\n\tsed -i s/rmk/linus/ .topdeps\n\tgit add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'\n\ttg update\n\n\t# Linus pulls from rmk\n\tgit checkout linus/master\n\tgit merge rmk/master\n\n\t# update test to linus+rmk\n\tgit checkout t/test\n\ttg update\n\n\t# inspect:\n\tgit diff linus/master refs/top-bases/t/test\n\nThe last command shows that refs/top-bases/t/test doesn't have arm.c\n:-/\n\nI'm sure the dependency deletion has exactly the same problem.\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"111049","messageId":"36ca99e90904110840g35fa3b37m45f0286cb1f99db6@mail.gmail.com","threadId":"18809","inReplyTo":"20090409201515.GA4218@pengutronix.de","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-04-11T15:40:04Z","receivedAt":"2009-04-11T15:40:04Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello,\n>\n> On Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:\n>> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:\n>> > On Thu, 9 Apr 2009 14:43:37 +0200\n>> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n>> >> You might want to check\n>> >>\n>> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581\n>> >\n>> > Ah this brings up more issues I had not thought about...  :-(  But perhaps\n>> > Bert's work could be used to help implement \"rm\".  Thoughts?\n>> No, it wont help. Because the base and tip of the topic should not\n>> changed in respect to the old state (expect for .topdeps of course).\n>>\n>> If you really want to remove a dependency, you need to revert a merge\n>> of this dep from the topic base. which is not possible today, or maybe\n>> I have just an idea for this:\n>>\n>>   'topic': the topic\n>>   'base':  the base of the topic, i.e. a merge from all dependent\n>> topics dep0, ..., depN\n>>\n>> say you want to remove dep0\n>>\n>>   1) merge all deps dep1, ..,depN into 'new-base'\n>>\n>>   2) merge 'new-base' into base with the merge driver 'theirs', that\n>> would overwrite all changes from dep0 in the 'base'\n>>\n>>   3) update 'topic' to the updated 'base'\n>>\n>> Any thoughts from someone who knows more than me?\n> Some time ago I thought about a similar issue:\n>\n> I based a branch on top of the Linux tree of the ARM maintainer (in the\n> following called \"rmk\") and decided later to base it on top of Linus'\n> tree.  So I did ~:\n>\n>        git checkout refs/top-bases/$branch\n>        git merge -s theirs linus/master\n>        git checkout $branch\n>        sed -i s,rmk,linus, .topdeps\n>        git add -f .topdeps\n>        git commit -m $commitmsg\n>        tg update\n>\n> When I thought about it with pencil and paper back then, I saw a problem\n> with that approach.  Now I invested some time now to verify it really\n> exists:  In fact I reverted the changes in the rmk/master branch.\n> Consider Linus pulls from rmk and I update my topgit branch.  Guess what\n> happens?  Linus' pull + my revert yield Linus' tree without rmk's\n> changes.\n>\n> Here is my recipe:\n>\n>        # prepare linus/master\n>        git init\n>        echo 'VERSION=2.6.28' > Makefile\n>        git add Makefile; git commit -m 'v2.6.28'\n>        git branch -m master linus/master\n>\n>        # prepare rmk/master\n>        git checkout -b rmk/master\n>        echo 'support for some machine' > arm.c\n>        git add arm.c; git commit -m 'support for some machine'\n>\n>        # new topgit branch\n>        tg create t/test\n>        echo change > lib.c\n>        git add lib.c; git commit -m 'tralala'\n>\n>        # Linus goes on ...\n>        git checkout linus/master\n>        echo 'VERSION=2.6.29-rc1' > Makefile\n>        git add Makefile; git commit -m 'v2.6.29-rc1'\n>\n>        # \"rebase\" test branch on linus/master\n>        git checkout refs/top-bases/t/test\n>        git symbolic-ref HEAD refs/top-bases/t/test\n>        git merge --no-commit linus/master\n>        git read-tree linus/master\n>        git commit\n>        rm arm.c\n>        git checkout t/test\n>        sed -i s/rmk/linus/ .topdeps\n>        git add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'\n>        tg update\n>\n>        # Linus pulls from rmk\n>        git checkout linus/master\n>        git merge rmk/master\n>\n>        # update test to linus+rmk\n>        git checkout t/test\n>        tg update\n>\n>        # inspect:\n>        git diff linus/master refs/top-bases/t/test\n>\n> The last command shows that refs/top-bases/t/test doesn't have arm.c\n> :-/\n>\n> I'm sure the dependency deletion has exactly the same problem.\nYou're probably right. I just found the old discussion about\ndependencies removal [1]:\n\nOn zo, 2008-09-21 at 16:24 +0200, Petr Baudis wrote:\n> The problem is that you can undo the merge content, but not the history\n> information. So this revert can e.g. propagate even into branches which\n> still *should* depend on the other branch, you get into trouble when you\n> want to make your branch depend on the other one anyway, etc.\n\nOn di, 2008-09-23 at 15:27 +0200, Petr Baudis wrote:\n> what we can't make to work is just the\n> most generic case, but e.g. if master is a *leaf* branch nothing else\n> depends on and it can't get the branch through multiple paths, you can\n> do the dependency removal rather easily (if it can get through multiple\n> paths, you can still do it but you might have to deal with big\n> conflicts).\n\nMaybe the leaf solution could be done.  Only directly depending\nbranches from the transitive reduction should be removable.  This\nwould help for the 'tip'/'current' branch usecase, for collecting\ntopics.\n\nBert\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093\n>\n> Best regards\n> Uwe\n"},{"id":"111058","messageId":"20090411190636.GA31461@pengutronix.de","threadId":"18809","inReplyTo":"36ca99e90904110840g35fa3b37m45f0286cb1f99db6@mail.gmail.com","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-04-11T19:06:36Z","receivedAt":"2009-04-11T19:06:36Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Bert,\n\nOn Sat, Apr 11, 2009 at 05:40:04PM +0200, Bert Wesarg wrote:\n> 2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> > Hello,\n> >\n> > On Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:\n> >> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:\n> >> > On Thu, 9 Apr 2009 14:43:37 +0200\n> >> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n> >> >> You might want to check\n> >> >>\n> >> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581\n> >> >\n> >> > Ah this brings up more issues I had not thought about...  :-(  But perhaps\n> >> > Bert's work could be used to help implement \"rm\".  Thoughts?\n> >> No, it wont help. Because the base and tip of the topic should not\n> >> changed in respect to the old state (expect for .topdeps of course).\n> >>\n> >> If you really want to remove a dependency, you need to revert a merge\n> >> of this dep from the topic base. which is not possible today, or maybe\n> >> I have just an idea for this:\n> >>\n> >>   'topic': the topic\n> >>   'base':  the base of the topic, i.e. a merge from all dependent\n> >> topics dep0, ..., depN\n> >>\n> >> say you want to remove dep0\n> >>\n> >>   1) merge all deps dep1, ..,depN into 'new-base'\n> >>\n> >>   2) merge 'new-base' into base with the merge driver 'theirs', that\n> >> would overwrite all changes from dep0 in the 'base'\n> >>\n> >>   3) update 'topic' to the updated 'base'\n> >>\n> >> Any thoughts from someone who knows more than me?\n> > Some time ago I thought about a similar issue:\n> >\n> > I based a branch on top of the Linux tree of the ARM maintainer (in the\n> > following called \"rmk\") and decided later to base it on top of Linus'\n> > tree.  So I did ~:\n> >\n> >        git checkout refs/top-bases/$branch\n> >        git merge -s theirs linus/master\n> >        git checkout $branch\n> >        sed -i s,rmk,linus, .topdeps\n> >        git add -f .topdeps\n> >        git commit -m $commitmsg\n> >        tg update\n> >\n> > When I thought about it with pencil and paper back then, I saw a problem\n> > with that approach.  Now I invested some time now to verify it really\n> > exists:  In fact I reverted the changes in the rmk/master branch.\n> > Consider Linus pulls from rmk and I update my topgit branch.  Guess what\n> > happens?  Linus' pull + my revert yield Linus' tree without rmk's\n> > changes.\n> >\n> > Here is my recipe:\n> >\n> >        # prepare linus/master\n> >        git init\n> >        echo 'VERSION=2.6.28' > Makefile\n> >        git add Makefile; git commit -m 'v2.6.28'\n> >        git branch -m master linus/master\n> >\n> >        # prepare rmk/master\n> >        git checkout -b rmk/master\n> >        echo 'support for some machine' > arm.c\n> >        git add arm.c; git commit -m 'support for some machine'\n> >\n> >        # new topgit branch\n> >        tg create t/test\n> >        echo change > lib.c\n> >        git add lib.c; git commit -m 'tralala'\n> >\n> >        # Linus goes on ...\n> >        git checkout linus/master\n> >        echo 'VERSION=2.6.29-rc1' > Makefile\n> >        git add Makefile; git commit -m 'v2.6.29-rc1'\n> >\n> >        # \"rebase\" test branch on linus/master\n> >        git checkout refs/top-bases/t/test\n> >        git symbolic-ref HEAD refs/top-bases/t/test\n> >        git merge --no-commit linus/master\n> >        git read-tree linus/master\n> >        git commit\n> >        rm arm.c\n> >        git checkout t/test\n> >        sed -i s/rmk/linus/ .topdeps\n> >        git add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'\n> >        tg update\n> >\n> >        # Linus pulls from rmk\n> >        git checkout linus/master\n> >        git merge rmk/master\n> >\n> >        # update test to linus+rmk\n> >        git checkout t/test\n> >        tg update\n> >\n> >        # inspect:\n> >        git diff linus/master refs/top-bases/t/test\n> >\n> > The last command shows that refs/top-bases/t/test doesn't have arm.c\n> > :-/\n> >\n> > I'm sure the dependency deletion has exactly the same problem.\nI think I've a solution.  Not an implementation yet, but the right\nthoughs (I hope):\n\ntg should not merge using the full history but fake the collapsed (as in\ntg export --collapse) history as HEAD.\n\n> You're probably right. I just found the old discussion about\n> dependencies removal [1]:\n> \n> On zo, 2008-09-21 at 16:24 +0200, Petr Baudis wrote:\n> > The problem is that you can undo the merge content, but not the history\n> > information. So this revert can e.g. propagate even into branches which\n> > still *should* depend on the other branch, you get into trouble when you\n> > want to make your branch depend on the other one anyway, etc.\n> \n> On di, 2008-09-23 at 15:27 +0200, Petr Baudis wrote:\n> > what we can't make to work is just the\n> > most generic case, but e.g. if master is a *leaf* branch nothing else\n> > depends on and it can't get the branch through multiple paths, you can\n> > do the dependency removal rather easily (if it can get through multiple\n> > paths, you can still do it but you might have to deal with big\n> > conflicts).\n> \n> Maybe the leaf solution could be done.  Only directly depending\n> branches from the transitive reduction should be removable.  This\n> would help for the 'tip'/'current' branch usecase, for collecting\n> topics.\n> \n> Bert\n> \n> [1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093\nThis link isn't optimal.  The highlighted message doesn't contain the\ncitations above :-/.\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"111082","messageId":"36ca99e90904111229l21d34100h8e9295748adc9853@mail.gmail.com","threadId":"18809","inReplyTo":"20090411190636.GA31461@pengutronix.de","subject":"Re: [PATCH] Add \"list\" and \"rm\" sub commands to tg-depend","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-04-11T19:29:15Z","receivedAt":"2009-04-11T19:29:15Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2009/4/11 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n>> [1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093\n> This link isn't optimal.  The highlighted message doesn't contain the\n> citations above :-/.\nSorry, haven't checked this. Here are the links again:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/96398\nhttp://article.gmane.org/gmane.comp.version-control.git/96560\n\nBert\n>\n> Best regards\n> Uwe\n>\n> --\n> Pengutronix e.K.                              | Uwe Kleine-König            |\n> Industrial Linux Solutions                    | http://www.pengutronix.de/  |\n>\n"}]}