git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
       [not found]       ` <20090409124337.GA6034@pengutronix.de>
@ 2009-04-09 17:34         ` Bert Wesarg
  2009-04-09 18:18           ` Ira Weiny
       [not found]         ` <20090409091021.5a7ded79.weiny2@llnl.gov>
  1 sibling, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2009-04-09 17:34 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Ira Weiny, Brian Behlendorf, Git Mailing List

2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hello Ira,
>
> On Wed, Apr 08, 2009 at 09:19:49AM -0700, Ira Weiny wrote:
>> On Wed, 8 Apr 2009 10:39:55 +0200
>> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
>>
>> > Hello,
>> >
>> > On Wed, Apr 08, 2009 at 10:08:24AM +0200, Petr Baudis wrote:
>> > > > 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.)
>> > tg-$command.txt is created by spliting README.
>>
>> Cool, thanks.
> You're welcome.  I'm glad you're sending patches.
>
>> > > > +       fi
>> > > > +       TMPFILE=`mktemp` || exit 1
>> > > > +       echo $TMPFILE
>> > > > +       grep -v public-ibmad-port $root_dir/.topdeps > $TMPFILE
>> > public-ibmad-port?
>>
>> Ok, I am pretty stupid for this one, sorry.
> np
>
>> > > > +       mv $TMPFILE $root_dir/.topdeps
>> > > > +else
>> > > > +       echo "$name" >>"$root_dir/.topdeps"
>> > > > +fi
>> > > > +
>> > > > +## commit it and update this branch
>> > > >  git add -f "$root_dir/.topdeps"
>> > > >  git commit -m"New TopGit dependency: $name"
>> > > >  $tg update
>> > > > --
>> > > > 1.5.4.5
>> > I don't think the patch is correct.  Just removing a branch from
>> > .topdeps is not enough.
>> >
>> > Did you try to export the tg-branch?  The result will be that the patch
>> > for that you deleted the dependency has the deleted change folded in.
>>
>> Indeed you are correct.  It was working for me because I was moving a node
>> from one place to another.  But the new location was still an ancestor of the
>> dependency which was removed.  I still think this can be automated but I will
>> have to work on it.
> So you mean that rm should only work if the patch is still a dependency?
>
> You might want to check
>
>        http://thread.gmane.org/gmane.comp.version-control.git/114581
>
> before investing time to implement it.  (I cc:d Bert Wesarg.)  If you
> had posted to git@vger.kernel.org Bert might have seen your mail alone.
> (hint hint)
Uwe,

thanks for the Cc.

I really can't reconstruct this thread, could some one send me the
original patch. My interest is this, that I implemented a tg-prev
(lists all deps from given topic), tg-next (lists topics depending on
the given topic), and a tg-tsort (which gives a topological list of
dependencies, which is a little outdated after the --graphviz option)

The original message seems lost in the archive, the comments are still there:

http://thread.gmane.org/gmane.comp.version-control.git/96483

I can send an update on this.

I think the first two commands could be added as sub-commands to
tg-depend, with bash completion you don't need to type that much
nowadays.

As I said to tg-tsort, its probably outdated because of the graphviz
output, but may still provide valid information.  Btw. does anyone
know a console output driver for the graphviz tools, i.e. dot and co?

Bert

>
> Best regards
> Uwe

PS: Finally added git list to Cc:

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
       [not found]         ` <20090409091021.5a7ded79.weiny2@llnl.gov>
@ 2009-04-09 18:01           ` Bert Wesarg
  2009-04-09 20:15             ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2009-04-09 18:01 UTC (permalink / raw)
  To: Ira Weiny; +Cc: Uwe Kleine-König, Brian Behlendorf, Git Mailing List

2009/4/9 Ira Weiny <weiny2@llnl.gov>:
> On Thu, 9 Apr 2009 14:43:37 +0200
> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
>> You might want to check
>>
>>       http:// thread.gmane.org/gmane.comp.version-control.git/114581
>
> Ah this brings up more issues I had not thought about...  :-(  But perhaps
> Bert's work could be used to help implement "rm".  Thoughts?
No, it wont help. Because the base and tip of the topic should not
changed in respect to the old state (expect for .topdeps of course).

If you really want to remove a dependency, you need to revert a merge
of this dep from the topic base. which is not possible today, or maybe
I have just an idea for this:

  'topic': the topic
  'base':  the base of the topic, i.e. a merge from all dependent
topics dep0, ..., depN

say you want to remove dep0

  1) merge all deps dep1, ..,depN into 'new-base'

  2) merge 'new-base' into base with the merge driver 'theirs', that
would overwrite all changes from dep0 in the 'base'

  3) update 'topic' to the updated 'base'

Any thoughts from someone who knows more than me?

Bert

> Thanks,
> Ira

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
  2009-04-09 17:34         ` [PATCH] Add "list" and "rm" sub commands to tg-depend Bert Wesarg
@ 2009-04-09 18:18           ` Ira Weiny
  0 siblings, 0 replies; 7+ messages in thread
From: Ira Weiny @ 2009-04-09 18:18 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Uwe Kleine-König, Brian Behlendorf, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 3462 bytes --]

On Thu, 9 Apr 2009 19:34:06 +0200
Bert Wesarg <bert.wesarg@googlemail.com> wrote:

> 2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > Hello Ira,
> >
> > On Wed, Apr 08, 2009 at 09:19:49AM -0700, Ira Weiny wrote:
> >> On Wed, 8 Apr 2009 10:39:55 +0200
> >> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> >>

[snip]

> >> > > > +       mv $TMPFILE $root_dir/.topdeps
> >> > > > +else
> >> > > > +       echo "$name" >>"$root_dir/.topdeps"
> >> > > > +fi
> >> > > > +
> >> > > > +## commit it and update this branch
> >> > > >  git add -f "$root_dir/.topdeps"
> >> > > >  git commit -m"New TopGit dependency: $name"
> >> > > >  $tg update
> >> > > > --
> >> > > > 1.5.4.5
> >> > I don't think the patch is correct.  Just removing a branch from
> >> > .topdeps is not enough.
> >> >
> >> > Did you try to export the tg-branch?  The result will be that the patch
> >> > for that you deleted the dependency has the deleted change folded in.
> >>
> >> Indeed you are correct.  It was working for me because I was moving a node
> >> from one place to another.  But the new location was still an ancestor of the
> >> dependency which was removed.  I still think this can be automated but I will
> >> have to work on it.
> > So you mean that rm should only work if the patch is still a dependency?
> >
> > You might want to check
> >
> >        http:// thread.gmane.org/gmane.comp.version-control.git/114581
> >
> > before investing time to implement it.  (I cc:d Bert Wesarg.)  If you
> > had posted to git@vger.kernel.org Bert might have seen your mail alone.
> > (hint hint)
> Uwe,
> 
> thanks for the Cc.
> 
> I really can't reconstruct this thread, could some one send me the
> original patch.

I have attached the original patch (cleaned up with Uwe's original comments).

NOTE: this will not work but I am just sending it to help reconstruct the
thread.

I think to do this properly you would have to either A) create a new branch
without the topic specified B) work your way back through the dependencies and
reverse patch all those nodes which do not have a common ancestor with any of
your other dependencies.  As an aside I found that topgit does not like you
removing the only dependency left.  I was unable to get that to work at all.
I don't know why.

I believe you specified option A in a message after this one, correct?

Ira

>
> My interest is this, that I implemented a tg-prev
> (lists all deps from given topic), tg-next (lists topics depending on
> the given topic), and a tg-tsort (which gives a topological list of
> dependencies, which is a little outdated after the --graphviz option)
> 
> The original message seems lost in the archive, the comments are still there:
> 
> http:// thread.gmane.org/gmane.comp.version-control.git/96483
> 
> I can send an update on this.
> 
> I think the first two commands could be added as sub-commands to
> tg-depend, with bash completion you don't need to type that much
> nowadays.
> 
> As I said to tg-tsort, its probably outdated because of the graphviz
> output, but may still provide valid information.  Btw. does anyone
> know a console output driver for the graphviz tools, i.e. dot and co?
> 
> Bert
> 
> >
> > Best regards
> > Uwe
> 
> PS: Finally added git list to Cc:
> 


-- 
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
weiny2@llnl.gov

[-- Attachment #2: 0001-Add-list-and-rm-sub-commands-to-tg-depend.patch --]
[-- Type: application/octet-stream, Size: 2584 bytes --]

From 3a424a1887a815ca742ef4bacec09b245658b1b7 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2@llnl.gov>
Date: Tue, 7 Apr 2009 13:03:48 -0700
Subject: [PATCH] Add "list" and "rm" sub commands to tg-depend


Signed-off-by: Ira Weiny <weiny2@llnl.gov>
---
 README       |   16 +++++++++++++---
 tg-depend.sh |   27 +++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/README b/README
index d2f095d..8b4356d 100644
--- a/README
+++ b/README
@@ -256,8 +256,13 @@ tg delete
 tg depend
 ~~~~~~~~~
 	Change dependencies of a TopGit-controlled topic branch.
-	This should have several subcommands, but only 'add' is
-	supported right now.
+	This command has the subcommands:
+		'list'  <== Default (run when no subcommand is given)
+		'add'
+		'rm'
+
+	'list' lists the topic branches on which the current topic branch
+	depends.
 
 	The 'add' subcommand takes an argument of a topic branch
 	to be added, adds it to '.topdeps', performs a commit and
@@ -266,7 +271,12 @@ tg depend
 	adjusting '.topmsg', prepare them in the index before
 	calling 'tg depend add'.
 
-	TODO: Subcommand for removing dependencies, obviously
+	The 'rm' subcommand takes an argument of a topic branch
+	to be removed, removes it from '.topdeps', performs a commit and
+	then updates your topic branch accordingly. If you want to
+	do other things related to the dependency addition, like
+	adjusting '.topmsg', prepare them in the index before
+	calling 'tg depend rm'.
 
 tg info
 ~~~~~~~
diff --git a/tg-depend.sh b/tg-depend.sh
index ef5f94f..6a4bc85 100644
--- a/tg-depend.sh
+++ b/tg-depend.sh
@@ -4,16 +4,25 @@
 # GPLv2
 
 name=
+mode=
 
 
 ## Parse options
 
 subcmd="$1"; shift || :
 case "$subcmd" in
-	-h|"")
+	-h)
 		echo "Usage: tg [...] depend add NAME" >&2
 		exit 1;;
 	add)
+		mode="add"
+		;;
+	""|list)
+		cat $root_dir/.topdeps
+		exit 0
+		;;
+	rm)
+		mode="rm"
 		;;
 	*)
 		die "unknown subcommand ($subcmd)";;
@@ -43,7 +52,21 @@ baserev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" ||
 
 ## Record new dependency
 
-echo "$name" >>"$root_dir/.topdeps"
+if [ "$mode" = "rm" ]; then
+	grep $name $root_dir/.topdeps > /dev/null
+	if [ "$?" != "0" ]; then
+		echo "Failed to find $name in dependency list"
+		exit 1
+	fi
+	TMPFILE=`mktemp` || exit 1
+	echo $TMPFILE
+	grep -v $name $root_dir/.topdeps > $TMPFILE
+	mv $TMPFILE $root_dir/.topdeps
+else
+	echo "$name" >>"$root_dir/.topdeps"
+fi
+
+## commit it and update this branch
 git add -f "$root_dir/.topdeps"
 git commit -m"New TopGit dependency: $name"
 $tg update
-- 
1.5.4.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
  2009-04-09 18:01           ` Bert Wesarg
@ 2009-04-09 20:15             ` Uwe Kleine-König
  2009-04-11 15:40               ` Bert Wesarg
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2009-04-09 20:15 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Ira Weiny, Brian Behlendorf, Git Mailing List

Hello,

On Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:
> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:
> > On Thu, 9 Apr 2009 14:43:37 +0200
> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> >> You might want to check
> >>
> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581
> >
> > Ah this brings up more issues I had not thought about...  :-(  But perhaps
> > Bert's work could be used to help implement "rm".  Thoughts?
> No, it wont help. Because the base and tip of the topic should not
> changed in respect to the old state (expect for .topdeps of course).
> 
> If you really want to remove a dependency, you need to revert a merge
> of this dep from the topic base. which is not possible today, or maybe
> I have just an idea for this:
> 
>   'topic': the topic
>   'base':  the base of the topic, i.e. a merge from all dependent
> topics dep0, ..., depN
> 
> say you want to remove dep0
> 
>   1) merge all deps dep1, ..,depN into 'new-base'
> 
>   2) merge 'new-base' into base with the merge driver 'theirs', that
> would overwrite all changes from dep0 in the 'base'
> 
>   3) update 'topic' to the updated 'base'
> 
> Any thoughts from someone who knows more than me?
Some time ago I thought about a similar issue:

I based a branch on top of the Linux tree of the ARM maintainer (in the
following called "rmk") and decided later to base it on top of Linus'
tree.  So I did ~:

	git checkout refs/top-bases/$branch
	git merge -s theirs linus/master
	git checkout $branch
	sed -i s,rmk,linus, .topdeps
	git add -f .topdeps
	git commit -m $commitmsg
	tg update

When I thought about it with pencil and paper back then, I saw a problem
with that approach.  Now I invested some time now to verify it really
exists:  In fact I reverted the changes in the rmk/master branch.
Consider Linus pulls from rmk and I update my topgit branch.  Guess what
happens?  Linus' pull + my revert yield Linus' tree without rmk's
changes.

Here is my recipe:

	# prepare linus/master
	git init
	echo 'VERSION=2.6.28' > Makefile
	git add Makefile; git commit -m 'v2.6.28'
	git branch -m master linus/master

	# prepare rmk/master
	git checkout -b rmk/master
	echo 'support for some machine' > arm.c
	git add arm.c; git commit -m 'support for some machine'

	# new topgit branch
	tg create t/test
	echo change > lib.c
	git add lib.c; git commit -m 'tralala'

	# Linus goes on ...
	git checkout linus/master
	echo 'VERSION=2.6.29-rc1' > Makefile
	git add Makefile; git commit -m 'v2.6.29-rc1'

	# "rebase" test branch on linus/master
	git checkout refs/top-bases/t/test
	git symbolic-ref HEAD refs/top-bases/t/test
	git merge --no-commit linus/master
	git read-tree linus/master
	git commit
	rm arm.c
	git checkout t/test
	sed -i s/rmk/linus/ .topdeps
	git add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'
	tg update

	# Linus pulls from rmk
	git checkout linus/master
	git merge rmk/master

	# update test to linus+rmk
	git checkout t/test
	tg update

	# inspect:
	git diff linus/master refs/top-bases/t/test

The last command shows that refs/top-bases/t/test doesn't have arm.c
:-/

I'm sure the dependency deletion has exactly the same problem.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
  2009-04-09 20:15             ` Uwe Kleine-König
@ 2009-04-11 15:40               ` Bert Wesarg
  2009-04-11 19:06                 ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Bert Wesarg @ 2009-04-11 15:40 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Ira Weiny, Brian Behlendorf, Git Mailing List

2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hello,
>
> On Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:
>> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:
>> > On Thu, 9 Apr 2009 14:43:37 +0200
>> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
>> >> You might want to check
>> >>
>> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581
>> >
>> > Ah this brings up more issues I had not thought about...  :-(  But perhaps
>> > Bert's work could be used to help implement "rm".  Thoughts?
>> No, it wont help. Because the base and tip of the topic should not
>> changed in respect to the old state (expect for .topdeps of course).
>>
>> If you really want to remove a dependency, you need to revert a merge
>> of this dep from the topic base. which is not possible today, or maybe
>> I have just an idea for this:
>>
>>   'topic': the topic
>>   'base':  the base of the topic, i.e. a merge from all dependent
>> topics dep0, ..., depN
>>
>> say you want to remove dep0
>>
>>   1) merge all deps dep1, ..,depN into 'new-base'
>>
>>   2) merge 'new-base' into base with the merge driver 'theirs', that
>> would overwrite all changes from dep0 in the 'base'
>>
>>   3) update 'topic' to the updated 'base'
>>
>> Any thoughts from someone who knows more than me?
> Some time ago I thought about a similar issue:
>
> I based a branch on top of the Linux tree of the ARM maintainer (in the
> following called "rmk") and decided later to base it on top of Linus'
> tree.  So I did ~:
>
>        git checkout refs/top-bases/$branch
>        git merge -s theirs linus/master
>        git checkout $branch
>        sed -i s,rmk,linus, .topdeps
>        git add -f .topdeps
>        git commit -m $commitmsg
>        tg update
>
> When I thought about it with pencil and paper back then, I saw a problem
> with that approach.  Now I invested some time now to verify it really
> exists:  In fact I reverted the changes in the rmk/master branch.
> Consider Linus pulls from rmk and I update my topgit branch.  Guess what
> happens?  Linus' pull + my revert yield Linus' tree without rmk's
> changes.
>
> Here is my recipe:
>
>        # prepare linus/master
>        git init
>        echo 'VERSION=2.6.28' > Makefile
>        git add Makefile; git commit -m 'v2.6.28'
>        git branch -m master linus/master
>
>        # prepare rmk/master
>        git checkout -b rmk/master
>        echo 'support for some machine' > arm.c
>        git add arm.c; git commit -m 'support for some machine'
>
>        # new topgit branch
>        tg create t/test
>        echo change > lib.c
>        git add lib.c; git commit -m 'tralala'
>
>        # Linus goes on ...
>        git checkout linus/master
>        echo 'VERSION=2.6.29-rc1' > Makefile
>        git add Makefile; git commit -m 'v2.6.29-rc1'
>
>        # "rebase" test branch on linus/master
>        git checkout refs/top-bases/t/test
>        git symbolic-ref HEAD refs/top-bases/t/test
>        git merge --no-commit linus/master
>        git read-tree linus/master
>        git commit
>        rm arm.c
>        git checkout t/test
>        sed -i s/rmk/linus/ .topdeps
>        git add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'
>        tg update
>
>        # Linus pulls from rmk
>        git checkout linus/master
>        git merge rmk/master
>
>        # update test to linus+rmk
>        git checkout t/test
>        tg update
>
>        # inspect:
>        git diff linus/master refs/top-bases/t/test
>
> The last command shows that refs/top-bases/t/test doesn't have arm.c
> :-/
>
> I'm sure the dependency deletion has exactly the same problem.
You're probably right. I just found the old discussion about
dependencies removal [1]:

On zo, 2008-09-21 at 16:24 +0200, Petr Baudis wrote:
> The problem is that you can undo the merge content, but not the history
> information. So this revert can e.g. propagate even into branches which
> still *should* depend on the other branch, you get into trouble when you
> want to make your branch depend on the other one anyway, etc.

On di, 2008-09-23 at 15:27 +0200, Petr Baudis wrote:
> what we can't make to work is just the
> most generic case, but e.g. if master is a *leaf* branch nothing else
> depends on and it can't get the branch through multiple paths, you can
> do the dependency removal rather easily (if it can get through multiple
> paths, you can still do it but you might have to deal with big
> conflicts).

Maybe the leaf solution could be done.  Only directly depending
branches from the transitive reduction should be removable.  This
would help for the 'tip'/'current' branch usecase, for collecting
topics.

Bert

[1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093
>
> Best regards
> Uwe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
  2009-04-11 15:40               ` Bert Wesarg
@ 2009-04-11 19:06                 ` Uwe Kleine-König
  2009-04-11 19:29                   ` Bert Wesarg
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2009-04-11 19:06 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Ira Weiny, Brian Behlendorf, Git Mailing List

Hello Bert,

On Sat, Apr 11, 2009 at 05:40:04PM +0200, Bert Wesarg wrote:
> 2009/4/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > Hello,
> >
> > On Thu, Apr 09, 2009 at 08:01:04PM +0200, Bert Wesarg wrote:
> >> 2009/4/9 Ira Weiny <weiny2@llnl.gov>:
> >> > On Thu, 9 Apr 2009 14:43:37 +0200
> >> > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> >> >> You might want to check
> >> >>
> >> >>       http:// thread.gmane.org/gmane.comp.version-control.git/114581
> >> >
> >> > Ah this brings up more issues I had not thought about...  :-(  But perhaps
> >> > Bert's work could be used to help implement "rm".  Thoughts?
> >> No, it wont help. Because the base and tip of the topic should not
> >> changed in respect to the old state (expect for .topdeps of course).
> >>
> >> If you really want to remove a dependency, you need to revert a merge
> >> of this dep from the topic base. which is not possible today, or maybe
> >> I have just an idea for this:
> >>
> >>   'topic': the topic
> >>   'base':  the base of the topic, i.e. a merge from all dependent
> >> topics dep0, ..., depN
> >>
> >> say you want to remove dep0
> >>
> >>   1) merge all deps dep1, ..,depN into 'new-base'
> >>
> >>   2) merge 'new-base' into base with the merge driver 'theirs', that
> >> would overwrite all changes from dep0 in the 'base'
> >>
> >>   3) update 'topic' to the updated 'base'
> >>
> >> Any thoughts from someone who knows more than me?
> > Some time ago I thought about a similar issue:
> >
> > I based a branch on top of the Linux tree of the ARM maintainer (in the
> > following called "rmk") and decided later to base it on top of Linus'
> > tree.  So I did ~:
> >
> >        git checkout refs/top-bases/$branch
> >        git merge -s theirs linus/master
> >        git checkout $branch
> >        sed -i s,rmk,linus, .topdeps
> >        git add -f .topdeps
> >        git commit -m $commitmsg
> >        tg update
> >
> > When I thought about it with pencil and paper back then, I saw a problem
> > with that approach.  Now I invested some time now to verify it really
> > exists:  In fact I reverted the changes in the rmk/master branch.
> > Consider Linus pulls from rmk and I update my topgit branch.  Guess what
> > happens?  Linus' pull + my revert yield Linus' tree without rmk's
> > changes.
> >
> > Here is my recipe:
> >
> >        # prepare linus/master
> >        git init
> >        echo 'VERSION=2.6.28' > Makefile
> >        git add Makefile; git commit -m 'v2.6.28'
> >        git branch -m master linus/master
> >
> >        # prepare rmk/master
> >        git checkout -b rmk/master
> >        echo 'support for some machine' > arm.c
> >        git add arm.c; git commit -m 'support for some machine'
> >
> >        # new topgit branch
> >        tg create t/test
> >        echo change > lib.c
> >        git add lib.c; git commit -m 'tralala'
> >
> >        # Linus goes on ...
> >        git checkout linus/master
> >        echo 'VERSION=2.6.29-rc1' > Makefile
> >        git add Makefile; git commit -m 'v2.6.29-rc1'
> >
> >        # "rebase" test branch on linus/master
> >        git checkout refs/top-bases/t/test
> >        git symbolic-ref HEAD refs/top-bases/t/test
> >        git merge --no-commit linus/master
> >        git read-tree linus/master
> >        git commit
> >        rm arm.c
> >        git checkout t/test
> >        sed -i s/rmk/linus/ .topdeps
> >        git add .topdeps; git commit -m 'change dep: rmk/master -> linus/master'
> >        tg update
> >
> >        # Linus pulls from rmk
> >        git checkout linus/master
> >        git merge rmk/master
> >
> >        # update test to linus+rmk
> >        git checkout t/test
> >        tg update
> >
> >        # inspect:
> >        git diff linus/master refs/top-bases/t/test
> >
> > The last command shows that refs/top-bases/t/test doesn't have arm.c
> > :-/
> >
> > I'm sure the dependency deletion has exactly the same problem.
I think I've a solution.  Not an implementation yet, but the right
thoughs (I hope):

tg should not merge using the full history but fake the collapsed (as in
tg export --collapse) history as HEAD.

> You're probably right. I just found the old discussion about
> dependencies removal [1]:
> 
> On zo, 2008-09-21 at 16:24 +0200, Petr Baudis wrote:
> > The problem is that you can undo the merge content, but not the history
> > information. So this revert can e.g. propagate even into branches which
> > still *should* depend on the other branch, you get into trouble when you
> > want to make your branch depend on the other one anyway, etc.
> 
> On di, 2008-09-23 at 15:27 +0200, Petr Baudis wrote:
> > what we can't make to work is just the
> > most generic case, but e.g. if master is a *leaf* branch nothing else
> > depends on and it can't get the branch through multiple paths, you can
> > do the dependency removal rather easily (if it can get through multiple
> > paths, you can still do it but you might have to deal with big
> > conflicts).
> 
> Maybe the leaf solution could be done.  Only directly depending
> branches from the transitive reduction should be removable.  This
> would help for the 'tip'/'current' branch usecase, for collecting
> topics.
> 
> Bert
> 
> [1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093
This link isn't optimal.  The highlighted message doesn't contain the
citations above :-/.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add "list" and "rm" sub commands to tg-depend
  2009-04-11 19:06                 ` Uwe Kleine-König
@ 2009-04-11 19:29                   ` Bert Wesarg
  0 siblings, 0 replies; 7+ messages in thread
From: Bert Wesarg @ 2009-04-11 19:29 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Ira Weiny, Brian Behlendorf, Git Mailing List

2009/4/11 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
>> [1] http://thread.gmane.org/gmane.comp.version-control.git/95458/focus=96093
> This link isn't optimal.  The highlighted message doesn't contain the
> citations above :-/.
Sorry, haven't checked this. Here are the links again:

http://article.gmane.org/gmane.comp.version-control.git/96398
http://article.gmane.org/gmane.comp.version-control.git/96560

Bert
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K.                              | Uwe Kleine-König            |
> Industrial Linux Solutions                    | http://www.pengutronix.de/  |
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-11 19:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090407133329.57b06727.weiny2@llnl.gov>
     [not found] ` <20090408080824.GF8940@machine.or.cz>
     [not found]   ` <20090408083955.GA28482@pengutronix.de>
     [not found]     ` <20090408091949.8a648d83.weiny2@llnl.gov>
     [not found]       ` <20090409124337.GA6034@pengutronix.de>
2009-04-09 17:34         ` [PATCH] Add "list" and "rm" sub commands to tg-depend Bert Wesarg
2009-04-09 18:18           ` Ira Weiny
     [not found]         ` <20090409091021.5a7ded79.weiny2@llnl.gov>
2009-04-09 18:01           ` Bert Wesarg
2009-04-09 20:15             ` Uwe Kleine-König
2009-04-11 15:40               ` Bert Wesarg
2009-04-11 19:06                 ` Uwe Kleine-König
2009-04-11 19:29                   ` Bert Wesarg

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).