git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Handling of branches in stgit
@ 2006-11-30  0:00 Yann Dirson
  2006-12-01 12:42 ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Dirson @ 2006-11-30  0:00 UTC (permalink / raw
  To: Catalin Marinas; +Cc: GIT list

I have started to work on recording parent information for stgit
branches, so we don't need to give the same info on every "git pull".

I'm facing a problem, in that we have several kind of stgit branches:

* those created against a cogito branch (eg. by "cg clone" and "stg
  init").  They work pretty much intuitively (and it happens I mostly
  used this flavour before those tests).  All we need is the name of
  the local branch, and "stg pull <branch>" relies on "git fetch" to
  find the repository information in .git/branches/<branch>.

  In this case, it is easy to request pulling from any branch, but
  usually only one of them is what you want, and the results of using
  another one (or forgetting to specify the one you want) can be
  annoying [ISSUE 1].  Hence this work of mine: being able to store
  this info in .git/patches/<stack>/parent (my initial implementation)
  was sufficient in theory.

  But "stg pull" allows for a refspec argument.  Since the branch
  mapping is already defined in a file, and I canno think of any
  useful way to override it, maybe we could make sure noone uses it in
  such a case ?

  
* but those created against a local branch are typically different,
  and updated by "stg pull . <branch>".  In that case, we have to
  specify the repository (".") explicitely, in addition to the branch,
  and the way to use the use them is different.


* and it gets better with those branches created against a git remote
  branch (eg. by "stg clone" or "stg branch -c" against an existing
  remote branch), typically updated via "stg pull <remote>", where the
  repo information is extracted by "git fetch" from
  .git/remotes/<remote>.  That is, we do not specify a branch or a
  repository URL, but an alias that may cover several branches from
  another repo.

  Here the branch information from the remotes file appears not to be
  used at all (in fact all branches are fetched - not sure that it's
  always what we want, but I'll wait to find myself limited by this
  behaviour before complaining ;)

  Also, "stgit pull <remote>" using "git pull" by default, it is the
  1st branch listed in the remotes file that gets taken as parent
  [ISSUE 2].  We should probably instead run "git fetch <remote>" and
  then then "git pull . <branch>", but that surely requires some
  changes to the "stg pull" internals.

  Thus (modulo that issue), we need 2 infos: "remote" and branch.
  Storing the latter should help to solve issue 2.

  Note: whereas "stg pull origin", while pulling a "foo" branch, cannot
  know current "foo2" branch should be rebased to "foo", (after renaming
  remotes/origin to foo) "stg pull foo", not only fetches "origin" as
  expected, but also (seemingly correctly but hell how does it know
  [ISSUE 3]) rebases current "master" to "origin" - is "master"
  special in any way here ?  I did not find anything about this in the
  source, although I found a handful of occurences of "master" in
  commands/branch.py, which seem to imply "master" is so special it
  cannot be deleted, which would look like abuse to me [ISSUE 4].


Now what do we do next ?

We could implement an ad-hoc solution acknowledging there are 3
different ways to work with a branch, keeping the current "stg pull"
syntaxes (they are already a pain for users IMHO) and storing
paremeters as ad-hoc values, or we could try to rework the "stg pull"
command line.

Some of my ideas for the latter include:

- store a "parent branch" with the name of the parent branch in the
local repository

- store a "parent repository" (ie. "." for local branches, "AUTO" for
cogito branches, and <remote> for git branches)

- rejecting non-default arguments and adding new options to allow to
specify/store alternative values

- we'll need to make sure there are no remote branches of one type
shadowed by one of the other type with same name, and do some sanity
checks that specified branch in a given remote really exists.


How does that sound ?
-- 

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

* Re: Handling of branches in stgit
  2006-11-30  0:00 Handling of branches in stgit Yann Dirson
@ 2006-12-01 12:42 ` Catalin Marinas
  2006-12-01 22:19   ` Yann Dirson
  0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2006-12-01 12:42 UTC (permalink / raw
  To: Yann Dirson; +Cc: GIT list

On 30/11/06, Yann Dirson <ydirson@altern.org> wrote:
> I have started to work on recording parent information for stgit
> branches, so we don't need to give the same info on every "git pull".

Isn't this what the branch.<name>.remote configuration option is for?
I think we should leave GIT handle this and StGIT only invoke "git
pull" without any arguments.

> I'm facing a problem, in that we have several kind of stgit branches:
>
> * those created against a cogito branch (eg. by "cg clone" and "stg
>   init").  They work pretty much intuitively (and it happens I mostly
>   used this flavour before those tests).  All we need is the name of
>   the local branch, and "stg pull <branch>" relies on "git fetch" to
>   find the repository information in .git/branches/<branch>.

But I think .git/branches got deprecated or it is a cogito-only feature.

>   In this case, it is easy to request pulling from any branch, but
>   usually only one of them is what you want, and the results of using
>   another one (or forgetting to specify the one you want) can be
>   annoying [ISSUE 1].  Hence this work of mine: being able to store
>   this info in .git/patches/<stack>/parent (my initial implementation)
>   was sufficient in theory.

I would leave this to GIT and its configuration files. Do you see any
problems with this approach?

I plan to merge the stgit config with the git one (and have a [stgit]
section) so that it is more maintainable.

-- 

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

* Re: Handling of branches in stgit
  2006-12-01 12:42 ` Catalin Marinas
@ 2006-12-01 22:19   ` Yann Dirson
  2006-12-05 22:51     ` Yann Dirson
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Dirson @ 2006-12-01 22:19 UTC (permalink / raw
  To: Catalin Marinas; +Cc: GIT list

On Fri, Dec 01, 2006 at 12:42:19PM +0000, Catalin Marinas wrote:
> On 30/11/06, Yann Dirson <ydirson@altern.org> wrote:
> >I have started to work on recording parent information for stgit
> >branches, so we don't need to give the same info on every "git pull".
> 
> Isn't this what the branch.<name>.remote configuration option is for?
> I think we should leave GIT handle this and StGIT only invoke "git
> pull" without any arguments.

This is one part of the problem (and I admit I have missed this config option),
the other one being having stgit pull the correct branch, unstead of
(implicitely) having git-pull using the 1st one in the remotes file.


> >I'm facing a problem, in that we have several kind of stgit branches:
> >
> >* those created against a cogito branch (eg. by "cg clone" and "stg
> >  init").  They work pretty much intuitively (and it happens I mostly
> >  used this flavour before those tests).  All we need is the name of
> >  the local branch, and "stg pull <branch>" relies on "git fetch" to
> >  find the repository information in .git/branches/<branch>.
> 
> But I think .git/branches got deprecated or it is a cogito-only feature.

.git/branches still seems to be the only type of branch created by
cogito.  And in fact, when remotes started to appear, I wondered how the 
cogito branch management (a quite intuitive and classical one) would be
made to work well with remotes-defining-several-branches, as well as
branches-potentially-defined-in-several-remotes (possible repo
inconsistency AFAICT, or maybe to specify different protocols to a
single repo ?) - and indeed I still don't have an answer, I guess cogito
would have to possibly change its user interface if it were to be able
to use multi-branch remotes.

In the meantime, we should support them in cogito.  And indeed, I found
stgit to work perfectly with those.


> >  In this case, it is easy to request pulling from any branch, but
> >  usually only one of them is what you want, and the results of using
> >  another one (or forgetting to specify the one you want) can be
> >  annoying [ISSUE 1].  Hence this work of mine: being able to store
> >  this info in .git/patches/<stack>/parent (my initial implementation)
> >  was sufficient in theory.
> 
> I would leave this to GIT and its configuration files. Do you see any
> problems with this approach?

I'd rather consider it a stgit issue: git itself does no have to know
which of the various heads descending from our stack base is to be
"prefered" by our stack.  Where to store it is anothe issue (see below).


> I plan to merge the stgit config with the git one (and have a [stgit]
> section) so that it is more maintainable.

Sure, let's take advantage of git-repo-config !
My latest 1/3 patch could then be seen as a 1st step towards an
abstraction of stgit object configuration, which could ease the transition
from file storage to config items :)

Best regards,
-- 
Yann.

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

* Re: Handling of branches in stgit
  2006-12-01 22:19   ` Yann Dirson
@ 2006-12-05 22:51     ` Yann Dirson
  0 siblings, 0 replies; 4+ messages in thread
From: Yann Dirson @ 2006-12-05 22:51 UTC (permalink / raw
  To: Catalin Marinas; +Cc: GIT list

On Fri, Dec 01, 2006 at 11:19:41PM +0100, Yann Dirson wrote:
> > >  annoying [ISSUE 1].  Hence this work of mine: being able to store
> > >  this info in .git/patches/<stack>/parent (my initial implementation)
> > >  was sufficient in theory.
> > 
> > I would leave this to GIT and its configuration files. Do you see any
> > problems with this approach?
> 
> I'd rather consider it a stgit issue: git itself does no have to know
> which of the various heads descending from our stack base is to be
> "prefered" by our stack.  Where to store it is anothe issue (see below).
> 
> 
> > I plan to merge the stgit config with the git one (and have a [stgit]
> > section) so that it is more maintainable.
> 
> Sure, let's take advantage of git-repo-config !
> My latest 1/3 patch could then be seen as a 1st step towards an
> abstraction of stgit object configuration, which could ease the transition

Indeed most of the current attributes of a stack (except maybe for the
description, which can hardly be seen as a config option) are quite
volatile, and thus unsuited for repo-config.
OTOH, as you said parent information would find easily its place there.


> > On 30/11/06, Yann Dirson <ydirson@altern.org> wrote:
> > >I have started to work on recording parent information for stgit
> > >branches, so we don't need to give the same info on every "git pull".
> >
> > Isn't this what the branch.<name>.remote configuration option is for?
> > I think we should leave GIT handle this and StGIT only invoke "git
> > pull" without any arguments.
> 
> This is one part of the problem (and I admit I have missed this config option),
> the other one being having stgit pull the correct branch, unstead of
> (implicitely) having git-pull using the 1st one in the remotes file.

I would also think that what really belongs to that config item would
be the declaration of which remote our parent branch should use to be
updated (ie. no need to duplicate the info in all the stgit stacks
forked off the same parent).

However it looks like this config option is not currently used unless
the branch to be git-fetched is the curent one, which is quite
annoying - we would need to get that setting ourselves to pass it to
git-fetch.

What's not clear to me is how to deal with cogito branches (maybe
check for the existence of .git/branches/<name> and then "git fetch
<name>" ?), and with local branches (how are we supposed to derive
that a branch is not a remote one ?  Should GIT add a
branch.<name>.remote or "." for locally-created branches ?).


We would also still need a config item to tell which parent branch we
should use, in order to know which branch.<name>.remote to extract,
and which branch to fast-forward our base onto.

Best regards,
-- 

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

end of thread, other threads:[~2006-12-05 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30  0:00 Handling of branches in stgit Yann Dirson
2006-12-01 12:42 ` Catalin Marinas
2006-12-01 22:19   ` Yann Dirson
2006-12-05 22:51     ` Yann Dirson

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).