From: Bert Wesarg Date: Mon, 01 Sep 2008 09:31:15 GMT Subject: Re: [TopGit PATCH] tg redepend: New command. Message-ID: <36ca99e90809010231o439ab4acsaa3027366c551ff6@mail.gmail.com> In-Reply-To: <1218808427.25300.2.camel@heerbeest> Hi, On Fri, Aug 15, 2008 at 15:53, Jan Nieuwenhuizen wrote: > As discussed previously > > http://kerneltrap.org/mailarchive/git/2008/8/13/2925144 > > Change a topgit branch's dependencies by doing a rebase-by-merge. > > is this script in use by you, or is it abandoned in favor of another idea? Anyway, I have tried it today but it looks like the top-bases wasn't updated to the new deps. It points still to the old base. Second, I got an empty line in my .topdeps file. > + > +if [ -n "$add" ]; then > + add="${add/# }" > + add="${add// / }" > + dupes=$(grep -E "^${add// /|}/\$" "$root_dir/.topdeps" | tr '\n' ' ') > + [ -z "$dupes" ] || die "already depend on: $dupes" > + redeps=$(echo "$add" | cat "$root_dir/.topdeps" - | tr '\n' ' ' | sed -e 's/ \+$//') > +elif [ -n "$remove" ]; then > + remove="${remove// / }" > + remove="${remove/# }" > + avail=$(grep -E "^${remove// /|}/\$" "$root_dir/.topdeps" | sort | tr '\n' ' ') > + remove_sorted=$(echo "$remove" | tr ' ' '\n' | grep -v '^$' | sort | tr '\n' ' ') > + [ "$avail" = "$remove_sorted" ] || die "not depending on some of: $remove" > + redeps=$(grep -vE "^${remove// /|}/\$" "$root_dir/.topdeps" | tr '\n' ' ') > +fi IMHO all these "| tr '\n' ' '" aren't needed. bash do the right thing here. Bert