Git development
 help / color / mirror / Atom feed
* Re: git checkout -b origin/mybranch origin/mybranch
From: Sverre Rabbelier @ 2009-03-12 11:40 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List
In-Reply-To: <43d8ce650903120436u261cb7e3p838e4a12e7b54d7d@mail.gmail.com>

Heya,

On Thu, Mar 12, 2009 at 12:36, John Tapsell <johnflux@gmail.com> wrote:
>  git complained that they need to specify the name with -b.  So they did:
>
> git checkout -b origin/somebranch origin/somebranch

Slight unrelated, do they know about -t?

$ git checkout -t origin/somebranch

It will automagically create a branch named 'somebranch' tracking
'origin/somebranch'!

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: git checkout -b origin/mybranch origin/mybranch
From: Johannes Schindelin @ 2009-03-12 11:43 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List
In-Reply-To: <43d8ce650903120436u261cb7e3p838e4a12e7b54d7d@mail.gmail.com>

Hi,

On Thu, 12 Mar 2009, John Tapsell wrote:

>   One of my collegues did:
> 
> git checkout origin/somebranch
> 
>   git complained that they need to specify the name with -b.  So they did:
> 
> git checkout -b origin/somebranch origin/somebranch

Yeah, a pilot error.  It should have been

	$ git checkout -t origin/somebranch

I have to wonder, though, why "git checkout origin/somebranch" did not 
detach your HEAD.

>   Git accepts this with no problems, but boy - all hell broke loose.
> Doing a push or pull gave errors, because "origin/somebranch" is now
> ambigous (since there is two of them).

I strongly doubt that it gave errors, but rather warnings.  I have a 
repository where I get warnings all the time (it has a cvsimport and an 
origin remote), but it works without problems.

>  They can't even:  "git checkout -b somebranch origin/somebranch"  
> anymore, since "origin/somebranch" is ambigous.  It all got into a mess.

I wonder why you did not just "git branch -m somebranch".

Ciao,
Dscho

^ permalink raw reply

* Re: git checkout -b origin/mybranch origin/mybranch
From: John Tapsell @ 2009-03-12 11:48 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git List
In-Reply-To: <alpine.DEB.1.00.0903121240400.10279@pacific.mpi-cbg.de>

2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Thu, 12 Mar 2009, John Tapsell wrote:
>
>>   One of my collegues did:
>>
>> git checkout origin/somebranch
>>
>>   git complained that they need to specify the name with -b.  So they did:
>>
>> git checkout -b origin/somebranch origin/somebranch
>
> Yeah, a pilot error.  It should have been
>
>        $ git checkout -t origin/somebranch

Maybe the error message for "git checkout origin/somebranch"  should
suggest:  git checkout -t origin/somebranch?

> I have to wonder, though, why "git checkout origin/somebranch" did not
> detach your HEAD.

It did.  But that doesn't affect doing "git checkout -b
origin/somebranch origin/somebranch"  afterwards.

>>   Git accepts this with no problems, but boy - all hell broke loose.
>> Doing a push or pull gave errors, because "origin/somebranch" is now
>> ambigous (since there is two of them).
>
> I strongly doubt that it gave errors, but rather warnings.  I have a
> repository where I get warnings all the time (it has a cvsimport and an
> origin remote), but it works without problems.
>
>>  They can't even:  "git checkout -b somebranch origin/somebranch"
>> anymore, since "origin/somebranch" is ambigous.  It all got into a mess.
>
> I wonder why you did not just "git branch -m somebranch".

Because they didn't know what on earth was going on, and git was
spitting out errors everywhere, they were afraid git would crash.

John

^ permalink raw reply

* Re: [PATCH v2] New config push.default to decide default behavior for push
From: Finn Arne Gangstad @ 2009-03-12 11:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vwsavlg6q.fsf@gitster.siamese.dyndns.org>

On Wed, Mar 11, 2009 at 05:48:13PM -0700, Junio C Hamano wrote:

> I thought I fixed asciidoc formatting around this part in the version I
> queued in 'pu'; in any case, the second and subsequent paragraphs need
> dedenting.

I am sorry, it wasn't immediately obvious to me that you had changed
the version i sent. Fixed up this (and other fixes) in my working
branch I think.

> > +static void setup_push_tracking(struct remote *remote)
> > +{
> > +	int n;
> > +	struct branch *branch = branch_get(NULL);
> > +	if (!branch)
> > +		die("You are not currently on a branch.");
> > +	if (!branch->merge_nr)
> > +		die("The current branch %s is not tracking anything.",
> > +		    branch->name);
> > +	if (branch->remote != remote)
> > +		die("The current branch is tracking \"%s\", not \"%s\"!",
> > +		    branch->remote->name, remote->name);
> > +	for (n = 0; n < branch->merge_nr; n++) {
> > +		struct strbuf rs = STRBUF_INIT;
> > +		strbuf_addf(&rs, "%s:%s", branch->name, branch->merge[n]->src);
> > +		add_refspec(rs.buf);
> > +	}
> > +}
> 
> If a branch is configured to merge from multiple places (e.g. testing
> branch similar to the linux-next tree to integrate from multiple staging
> trees), a sane default would be not to push it out to any of the branches
> it pulls from---it is a consumer to the other branches, and it is meant to
> be sent to somewhere else, not back to any of the originators.  Instead,
> this code will push to all of them, which I would not see any sane use
> case for.  It might make a bit sense if you refused unless merge_nr is
> exactly one.

Yes I agree, fixed this up.

> Also I am not sure if the check between the name of the remote makes much
> practical sense.  Many people use two remotes to name the same one for
> pushing over ssh and fetching over git.  Which name comes in which?  I
> think with this logic you are trying to catch a mistake like:
> 
>     $ git push --tracking $there

Yes that was the idea. I was not familiar with the "multiple remotes
to the same thing" common usage, but have no problems supporting that
instead.

Something like this amended into the last commit? I can amend it on top
of the last one and resend if that is better.

--8<--
git push tracking mode fixes

If a branch is tracking multiple branches, refuse to push it.
Some asciidoc format fixes.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
---
To be amended into the previous commit

 Documentation/config.txt |   16 ++++++++--------
 builtin-push.c           |   25 +++++++++++--------------
 2 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6fdf829..986becc 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1165,19 +1165,19 @@ push.default::
 	on the command line, no refspec is configured in the remote, and
 	no refspec is implied by any of the options given on the command
 	line.
-
-	The term `current remote` means the remote configured for the current
-	branch, or `origin` if no remote is configured. `origin` is also used
-	if you are not on any branch.
-
-	Possible values are:
++
+The term `current remote` means the remote configured for the current
+branch, or `origin` if no remote is configured. `origin` is also used
+if you are not on any branch. Possible values are:
 +
 * `nothing` do not push anything.
 * `matching` push all matching branches to the current remote.
   All branches having the same name in both ends are considered to be
   matching. This is the current default value.
-* `tracking` push the current branch to whatever it is tracking.
-* `current` push the current branch to a branch of the same name.
+* `tracking` push the current branch to the branch it is tracking.
+* `current` push the current branch to a branch of the same name on the
+  current remote.
+
 
 receive.fsckObjects::
 	If it is set to true, git-receive-pack will check all received
diff --git a/builtin-push.c b/builtin-push.c
index fa5eabb..51f4c4a 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -48,23 +48,20 @@ static void set_refspecs(const char **refs, int nr)
 	}
 }
 
-static void setup_push_tracking(struct remote *remote)
+static void setup_push_tracking(void)
 {
-	int n;
+	struct strbuf refspec = STRBUF_INIT;
 	struct branch *branch = branch_get(NULL);
 	if (!branch)
 		die("You are not currently on a branch.");
 	if (!branch->merge_nr)
 		die("The current branch %s is not tracking anything.",
 		    branch->name);
-	if (branch->remote != remote)
-		die("The current branch is tracking \"%s\", not \"%s\"!",
-		    branch->remote->name, remote->name);
-	for (n = 0; n < branch->merge_nr; n++) {
-		struct strbuf rs = STRBUF_INIT;
-		strbuf_addf(&rs, "%s:%s", branch->name, branch->merge[n]->src);
-		add_refspec(rs.buf);
-	}
+	if (branch->merge_nr != 1)
+		die("The current branch %s is tracking multiple branches, "
+		    "refusing to push.", branch->name);
+	strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
+	add_refspec(refspec.buf);
 }
 
 static const char *warn_unconfigured_push_msg[] = {
@@ -83,14 +80,14 @@ static const char *warn_unconfigured_push_msg[] = {
 	""
 };
 
-static void warn_unconfigured_push()
+static void warn_unconfigured_push(void)
 {
 	int i;
 	for (i = 0; i < ARRAY_SIZE(warn_unconfigured_push_msg); i++)
 		warning("%s", warn_unconfigured_push_msg[i]);
 }
 
-static void do_default_push(struct remote *remote)
+static void do_default_push(void)
 {
 	git_config(git_default_config, NULL);
 	switch (push_default) {
@@ -103,7 +100,7 @@ static void do_default_push(struct remote *remote)
 		break;
 
 	case PUSH_DEFAULT_TRACKING:
-		setup_push_tracking(remote);
+		setup_push_tracking();
 		break;
 
 	case PUSH_DEFAULT_CURRENT:
@@ -150,7 +147,7 @@ static int do_push(const char *repo, int flags)
 			refspec = remote->push_refspec;
 			refspec_nr = remote->push_refspec_nr;
 		} else if (!(flags & TRANSPORT_PUSH_MIRROR))
-			do_default_push(remote);
+			do_default_push();
 	}
 	errs = 0;
 	for (i = 0; i < remote->url_nr; i++) {
-- 
1.6.2.81.gc6c21.dirty

^ permalink raw reply related

* [StGit PATCH 1/5] Check for local changes with "goto"
From: Catalin Marinas @ 2009-03-12 12:08 UTC (permalink / raw)
  To: git, Karl Hasselström
In-Reply-To: <20090312120426.2992.35213.stgit@pc1117.cambridge.arm.com>

This is done by default, unless the --keep option is passed, for
consistency with the "pop" command. The index is checked in the
Transaction.run() function so that other commands could benefit from
this feature (off by default).

This behaviour can be overridden by setting the stgit.autokeep option.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 examples/gitconfig        |    3 +++
 stgit/argparse.py         |    5 +++++
 stgit/commands/goto.py    |    7 +++++--
 stgit/lib/git.py          |   14 ++++++++++++--
 stgit/lib/transaction.py  |   10 +++++++++-
 t/t2300-refresh-subdir.sh |    2 +-
 t/t2800-goto-subdir.sh    |    4 ++--
 t/t3000-dirty-merge.sh    |    2 +-
 8 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/examples/gitconfig b/examples/gitconfig
index 9efc089..2fc5f52 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -103,6 +103,9 @@
 	# -O/--diff-opts). For example, -M turns on rename detection.
 	#diff-opts = -M
 
+	# Behave as if the --keep option is always passed
+	#autokeep = no
+
 [mail "alias"]
 	# E-mail aliases used with the 'mail' command
 	git = git@vger.kernel.org
diff --git a/stgit/argparse.py b/stgit/argparse.py
index 418a506..85ee6e3 100644
--- a/stgit/argparse.py
+++ b/stgit/argparse.py
@@ -220,6 +220,11 @@ def _person_opts(person, short):
 def author_options():
     return _person_opts('author', 'auth')
 
+def keep_option():
+    return [opt('-k', '--keep', action = 'store_true',
+                short = 'Keep the local changes',
+                default = config.get('stgit.autokeep') == 'yes')]
+
 class CompgenBase(object):
     def actions(self, var): return set()
     def words(self, var): return set()
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 60a917e..0f67314 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 from stgit.commands import common
 from stgit.lib import transaction
 from stgit import argparse
+from stgit.argparse import opt
 
 help = 'Push or pop patches to the given one'
 kind = 'stack'
@@ -27,7 +28,7 @@ Push/pop patches to/from the stack until the one given on the command
 line becomes current."""
 
 args = [argparse.other_applied_patches, argparse.unapplied_patches]
-options = []
+options = argparse.keep_option()
 
 directory = common.DirectoryHasRepositoryLib()
 
@@ -38,7 +39,9 @@ def func(parser, options, args):
 
     stack = directory.repository.current_stack
     iw = stack.repository.default_iw
-    trans = transaction.StackTransaction(stack, 'goto')
+    clean_iw = not options.keep and iw or None
+    trans = transaction.StackTransaction(stack, 'goto',
+                                         check_clean_iw = clean_iw)
     if patch in trans.applied:
         to_pop = set(trans.applied[trans.applied.index(patch)+1:])
         assert not trans.pop_patches(lambda pn: pn in to_pop)
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index e2b4266..07079b8 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -706,9 +706,11 @@ class Index(RunWithEnv):
                     ).output_one_line())
         except run.RunException:
             raise MergeException('Conflicting merge')
-    def is_clean(self):
+    def is_clean(self, tree):
+        """Check whether the index is clean relative to the given treeish."""
         try:
-            self.run(['git', 'update-index', '--refresh']).discard_output()
+            self.run(['git', 'diff-index', '--quiet', '--cached', tree.sha1]
+                    ).discard_output()
         except run.RunException:
             return False
         else:
@@ -858,6 +860,14 @@ class IndexAndWorktree(RunWithEnvCwd):
         cmd = ['git', 'update-index', '--remove']
         self.run(cmd + ['-z', '--stdin']
                  ).input_nulterm(paths).discard_output()
+    def worktree_clean(self):
+        """Check whether the worktree is clean relative to index."""
+        try:
+            self.run(['git', 'update-index', '--refresh']).discard_output()
+        except run.RunException:
+            return False
+        else:
+            return True
 
 class Branch(object):
     """Represents a Git branch."""
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 54de127..5a81f9d 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -75,7 +75,8 @@ class StackTransaction(object):
       your refs and index+worktree, or fail without having done
       anything."""
     def __init__(self, stack, msg, discard_changes = False,
-                 allow_conflicts = False, allow_bad_head = False):
+                 allow_conflicts = False, allow_bad_head = False,
+                 check_clean_iw = None):
         """Create a new L{StackTransaction}.
 
         @param discard_changes: Discard any changes in index+worktree
@@ -102,6 +103,8 @@ class StackTransaction(object):
         self.__temp_index = self.temp_index_tree = None
         if not allow_bad_head:
             self.__assert_head_top_equal()
+        if check_clean_iw:
+            self.__assert_index_worktree_clean(check_clean_iw)
     stack = property(lambda self: self.__stack)
     patches = property(lambda self: self.__patches)
     def __set_applied(self, val):
@@ -147,6 +150,11 @@ class StackTransaction(object):
                 'This can happen if you modify a branch with git.',
                 '"stg repair --help" explains more about what to do next.')
             self.__abort()
+    def __assert_index_worktree_clean(self, iw):
+        if not iw.worktree_clean() or \
+           not iw.index.is_clean(self.stack.head):
+            self.__halt('Repository not clean. Use "refresh" or '
+                        '"status --reset"')
     def __checkout(self, tree, iw, allow_bad_head):
         if not allow_bad_head:
             self.__assert_head_top_equal()
diff --git a/t/t2300-refresh-subdir.sh b/t/t2300-refresh-subdir.sh
index d731a11..89c95db 100755
--- a/t/t2300-refresh-subdir.sh
+++ b/t/t2300-refresh-subdir.sh
@@ -65,7 +65,7 @@ test_expect_success 'refresh -u -p <subdir>' '
 
 test_expect_success 'refresh an unapplied patch' '
     stg refresh -u &&
-    stg goto p0 &&
+    stg goto --keep p0 &&
     test "$(stg status)" = "M foo.txt" &&
     stg refresh -p p1 &&
     test "$(stg status)" = "" &&
diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
index 28b8292..855972b 100755
--- a/t/t2800-goto-subdir.sh
+++ b/t/t2800-goto-subdir.sh
@@ -25,7 +25,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (just pop)' '
-    (cd foo && stg goto p1) &&
+    (cd foo && stg goto --keep p1) &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
     ls foo > actual.txt &&
@@ -48,7 +48,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (conflicting push)' '
-    (cd foo && stg goto p3) ;
+    (cd foo && stg goto --keep p3) ;
     [ $? -eq 3 ] &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
diff --git a/t/t3000-dirty-merge.sh b/t/t3000-dirty-merge.sh
index f0f79d5..419d86e 100755
--- a/t/t3000-dirty-merge.sh
+++ b/t/t3000-dirty-merge.sh
@@ -26,7 +26,7 @@ test_expect_success 'Push with dirty worktree' '
     echo 4 > a &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
-    conflict stg goto p2 &&
+    conflict stg goto --keep p2 &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
     [ "$(echo $(cat a))" = "4" ]

^ permalink raw reply related

* [StGit PATCH 0/5] Various StGit patches
From: Catalin Marinas @ 2009-03-12 12:08 UTC (permalink / raw)
  To: git, Karl Hasselström

Some of these patches were posted before and there were some suggestions
which I added. The "Check for local changes with goto" patch was
slightly improved so that the "stgit.keep" option could be set to "yes"
if this is preferred as a default behaviour.

I plan to implement transition as many commands as possible to the new
infrastructure. For some of them it should be trivial. The "status"
command needs some support in stgit.lib.


Catalin Marinas (5):
      Convert "float" to the lib infrastructure
      Convert "sink" to the new infrastructure
      Add automatic git-mergetool invocation to the new infrastructure
      Add mergetool support to the classic StGit infrastructure
      Check for local changes with "goto"


 examples/gitconfig         |   24 +------
 stgit/argparse.py          |    5 +
 stgit/commands/edit.py     |    2 -
 stgit/commands/float.py    |   75 +++++++++-------------
 stgit/commands/goto.py     |    9 ++-
 stgit/commands/resolved.py |    5 -
 stgit/commands/sink.py     |   86 +++++++++++--------------
 stgit/config.py            |    1 
 stgit/git.py               |   33 ++++++----
 stgit/gitmergeonefile.py   |  150 --------------------------------------------
 stgit/lib/git.py           |   35 +++++++++-
 stgit/lib/transaction.py   |   17 ++++-
 t/t0002-status.sh          |    3 -
 t/t1501-sink.sh            |    2 -
 t/t2300-refresh-subdir.sh  |    2 -
 t/t2800-goto-subdir.sh     |    4 +
 t/t3000-dirty-merge.sh     |    2 -
 17 files changed, 153 insertions(+), 302 deletions(-)
 delete mode 100644 stgit/gitmergeonefile.py

-- 
Catalin

^ permalink raw reply

* [StGit PATCH 2/5] Add mergetool support to the classic StGit infrastructure
From: Catalin Marinas @ 2009-03-12 12:09 UTC (permalink / raw)
  To: git, Karl Hasselström
In-Reply-To: <20090312120426.2992.35213.stgit@pc1117.cambridge.arm.com>

Since Git already has a tool for interactively solving conflicts which
is highly customisable, there is no need to duplicate this feature via
the i3merge and i2merge configuration options. The user-visible change
is that now mergetool is invoked rather than the previously customised
interactive merging tool.

The stgit.keeporig option is no longer available to be more consistent
with the Git behaviour.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 examples/gitconfig         |   21 +-----
 stgit/commands/resolved.py |    5 -
 stgit/config.py            |    1 
 stgit/git.py               |   33 ++++++----
 stgit/gitmergeonefile.py   |  150 --------------------------------------------
 t/t0002-status.sh          |    3 -
 6 files changed, 22 insertions(+), 191 deletions(-)
 delete mode 100644 stgit/gitmergeonefile.py

diff --git a/examples/gitconfig b/examples/gitconfig
index 2fc5f52..f6e3a79 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -64,27 +64,10 @@
 	# To support local parent branches:
 	#pull-policy = rebase
 
-	# Interactive two/three-way merge tool. It is executed by the
-	# 'resolved --interactive' command
-	#i3merge = xxdiff --title1 current --title2 ancestor --title3 patched \
-	#	--show-merged-pane -m -E -O -X -M \"%(output)s\" \
-	#	\"%(branch1)s\" \"%(ancestor)s\" \"%(branch2)s\"
-	#i2merge = xxdiff --title1 current --title2 patched \
-	#	--show-merged-pane -m -E -O -X -M \"%(output)s\" \
-	#	\"%(branch1)s\" \"%(branch2)s\"
-	#i3merge = emacs --eval '(ediff-merge-files-with-ancestor \
-	#	\"%(branch1)s\" \"%(branch2)s\" \"%(ancestor)s\" nil \
-	#	\"%(output)s\")'
-	#i2merge = emacs --eval '(ediff-merge-files \
-	#	\"%(branch1)s\" \"%(branch2)s\" nil \"%(output)s\")'
-
-	# Automatically invoke the interactive merger in case of conflicts
+	# Automatically invoke the interactive merger (git mergetool) in case
+	# of conflicts
 	#autoimerge = no
 
-	# Leave the original files in the working tree in case of a
-	# merge conflict
-	#keeporig = yes
-
 	# Optimize (repack) the object store after every pull
 	#keepoptimized = yes
 
diff --git a/stgit/commands/resolved.py b/stgit/commands/resolved.py
index 2ce7ec3..eba778d 100644
--- a/stgit/commands/resolved.py
+++ b/stgit/commands/resolved.py
@@ -22,7 +22,6 @@ from stgit.commands.common import *
 from stgit.utils import *
 from stgit import argparse, stack, git, basedir
 from stgit.config import config, file_extensions
-from stgit.gitmergeonefile import interactive_merge
 
 help = 'Mark a file conflict as solved'
 kind = 'wc'
@@ -78,8 +77,6 @@ def func(parser, options, args):
 
     # resolved
     if options.interactive:
-        for filename in files:
-            interactive_merge(filename)
-            git.resolved([filename])
+        git.mergetool(files)
     else:
         git.resolved(files, options.reset)
diff --git a/stgit/config.py b/stgit/config.py
index 05ef624..efce097 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -35,7 +35,6 @@ class GitConfig:
         'stgit.fetchcmd':	'git fetch',
         'stgit.pull-policy':	'pull',
         'stgit.autoimerge':	'no',
-        'stgit.keeporig':	'yes',
         'stgit.keepoptimized':	'no',
         'stgit.extensions':	'.ancestor .current .patched',
         'stgit.shortnr':	 '5'
diff --git a/stgit/git.py b/stgit/git.py
index 4d01fc2..50e3621 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os, re, gitmergeonefile
+import sys, os, re
 from shutil import copyfile
 
 from stgit.exception import *
@@ -632,19 +632,25 @@ def merge_recursive(base, head1, head2):
     output = p.output_lines()
     if p.exitcode:
         # There were conflicts
-        conflicts = [l.strip() for l in output if l.startswith('CONFLICT')]
+        if config.get('stgit.autoimerge') == 'yes':
+            mergetool()
+        else:
+            conflicts = [l for l in output if l.startswith('CONFLICT')]
+            out.info(*conflicts)
+            raise GitException, "%d conflict(s)" % len(conflicts)
+
+def mergetool(files = ()):
+    """Invoke 'git mergetool' to resolve any outstanding conflicts. If 'not
+    files', all the files in an unmerged state will be processed."""
+    err = os.system('git mergetool %s' % ' '.join(files))
+    # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+    # merge_recursive())
+    conflicts = ['CONFLICT ' + f for f in get_conflicts()]
+    if conflicts:
         out.info(*conflicts)
-
-        # try the interactive merge or stage checkout (if enabled)
-        for filename in get_conflicts():
-            if (gitmergeonefile.merge(filename)):
-                # interactive merge succeeded
-                resolved([filename])
-
-        # any conflicts left unsolved?
-        cn = len(get_conflicts())
-        if cn:
-            raise GitException, "%d conflict(s)" % cn
+        raise GitException, "%d conflict(s)" % len(conflicts)
+    elif err:
+        raise GitException('"git mergetool" failed, exit code: %d' % err)
 
 def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = [],
          binary = True):
@@ -754,7 +760,6 @@ def resolved(filenames, reset = None):
              '--stdin', '-z').input_nulterm(filenames).no_output()
     GRun('update-index', '--add', '--').xargs(filenames)
     for filename in filenames:
-        gitmergeonefile.clean_up(filename)
         # update the access and modificatied times
         os.utime(filename, None)
 
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
deleted file mode 100644
index 1fe226e..0000000
--- a/stgit/gitmergeonefile.py
+++ /dev/null
@@ -1,150 +0,0 @@
-"""Performs a 3-way merge for GIT files
-"""
-
-__copyright__ = """
-Copyright (C) 2006, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-import sys, os
-from stgit.exception import *
-from stgit import basedir
-from stgit.config import config, file_extensions, ConfigOption
-from stgit.utils import append_string
-from stgit.out import *
-from stgit.run import *
-
-class GitMergeException(StgException):
-    pass
-
-
-#
-# Options
-#
-autoimerge = ConfigOption('stgit', 'autoimerge')
-keeporig = ConfigOption('stgit', 'keeporig')
-
-#
-# Utility functions
-#
-def __str2none(x):
-    if x == '':
-        return None
-    else:
-        return x
-
-class MRun(Run):
-    exc = GitMergeException # use a custom exception class on errors
-
-def __checkout_stages(filename):
-    """Check-out the merge stages in the index for the give file
-    """
-    extensions = file_extensions()
-    line = MRun('git', 'checkout-index', '--stage=all', '--', filename
-                ).output_one_line()
-    stages, path = line.split('\t')
-    stages = dict(zip(['ancestor', 'current', 'patched'],
-                      stages.split(' ')))
-
-    for stage, fn in stages.iteritems():
-        if stages[stage] == '.':
-            stages[stage] = None
-        else:
-            newname = filename + extensions[stage]
-            if os.path.exists(newname):
-                # remove the stage if it is already checked out
-                os.remove(newname)
-            os.rename(stages[stage], newname)
-            stages[stage] = newname
-
-    return stages
-
-def __remove_stages(filename):
-    """Remove the merge stages from the working directory
-    """
-    extensions = file_extensions()
-    for ext in extensions.itervalues():
-        fn = filename + ext
-        if os.path.isfile(fn):
-            os.remove(fn)
-
-def interactive_merge(filename):
-    """Run the interactive merger on the given file. Stages will be
-    removed according to stgit.keeporig. If successful and stages
-    kept, they will be removed via git.resolved().
-    """
-    stages = __checkout_stages(filename)
-
-    try:
-        # Check whether we have all the files for the merge.
-        if not (stages['current'] and stages['patched']):
-            raise GitMergeException('Cannot run the interactive merge')
-
-        if stages['ancestor']:
-            three_way = True
-            files_dict = {'branch1': stages['current'],
-                          'ancestor': stages['ancestor'],
-                          'branch2': stages['patched'],
-                          'output': filename}
-            imerger = config.get('stgit.i3merge')
-        else:
-            three_way = False
-            files_dict = {'branch1': stages['current'],
-                          'branch2': stages['patched'],
-                          'output': filename}
-            imerger = config.get('stgit.i2merge')
-
-        if not imerger:
-            raise GitMergeException, 'No interactive merge command configured'
-
-        mtime = os.path.getmtime(filename)
-
-        out.start('Trying the interactive %s merge'
-                  % (three_way and 'three-way' or 'two-way'))
-        err = os.system(imerger % files_dict)
-        out.done()
-        if err != 0:
-            raise GitMergeException, 'The interactive merge failed'
-        if not os.path.isfile(filename):
-            raise GitMergeException, 'The "%s" file is missing' % filename
-        if mtime == os.path.getmtime(filename):
-            raise GitMergeException, 'The "%s" file was not modified' % filename
-    finally:
-        # keep the merge stages?
-        if str(keeporig) != 'yes':
-            __remove_stages(filename)
-
-def clean_up(filename):
-    """Remove merge conflict stages if they were generated.
-    """
-    if str(keeporig) == 'yes':
-        __remove_stages(filename)
-
-def merge(filename):
-    """Merge one file if interactive is allowed or check out the stages
-    if keeporig is set.
-    """
-    if str(autoimerge) == 'yes':
-        try:
-            interactive_merge(filename)
-        except GitMergeException, ex:
-            out.error(str(ex))
-            return False
-        return True
-
-    if str(keeporig) == 'yes':
-        __checkout_stages(filename)
-
-    return False
diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index ac92aa8..d95a83b 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -107,9 +107,6 @@ test_expect_success 'Make a conflicting patch' '
 '
 
 cat > expected.txt <<EOF
-? foo/bar.ancestor
-? foo/bar.current
-? foo/bar.patched
 A fie
 C foo/bar
 EOF

^ permalink raw reply related

* [StGit PATCH 3/5] Add automatic git-mergetool invocation to the new infrastructure
From: Catalin Marinas @ 2009-03-12 12:09 UTC (permalink / raw)
  To: git, Karl Hasselström
In-Reply-To: <20090312120426.2992.35213.stgit@pc1117.cambridge.arm.com>

This patch adds the IndexAndWorktree.mergetool() function responsible
for calling 'git mergetool' to interactively solve conflicts. The
function may also be called from IndexAndWorktree.merge() if the
standard 'git merge-recursive' fails and 'interactive == True'. The
'allow_interactive' parameter is passed to Transaction.push_patch() from
the functions allowing interactive merging.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/edit.py   |    2 +-
 stgit/commands/goto.py   |    2 +-
 stgit/lib/git.py         |   21 ++++++++++++++++++---
 stgit/lib/transaction.py |    7 +++++--
 4 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index ed785aa..42eb792 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -128,7 +128,7 @@ def func(parser, options, args):
     trans.patches[patchname] = stack.repository.commit(cd)
     try:
         for pn in popped:
-            trans.push_patch(pn, iw)
+            trans.push_patch(pn, iw, allow_interactive = True)
     except transaction.TransactionHalted:
         pass
     try:
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 0f67314..56c09da 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -48,7 +48,7 @@ def func(parser, options, args):
     elif patch in trans.unapplied:
         try:
             for pn in trans.unapplied[:trans.unapplied.index(patch)+1]:
-                trans.push_patch(pn, iw)
+                trans.push_patch(pn, iw, allow_interactive = True)
         except transaction.TransactionHalted:
             pass
     elif patch in trans.hidden:
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 07079b8..d83b475 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -824,7 +824,7 @@ class IndexAndWorktree(RunWithEnvCwd):
                      ).discard_output()
         except run.RunException:
             raise CheckoutException('Index/workdir dirty')
-    def merge(self, base, ours, theirs):
+    def merge(self, base, ours, theirs, interactive = False):
         assert isinstance(base, Tree)
         assert isinstance(ours, Tree)
         assert isinstance(theirs, Tree)
@@ -838,10 +838,25 @@ class IndexAndWorktree(RunWithEnvCwd):
             output = r.output_lines()
             if r.exitcode:
                 # There were conflicts
-                conflicts = [l for l in output if l.startswith('CONFLICT')]
-                raise MergeConflictException(conflicts)
+                if interactive:
+                    self.mergetool()
+                else:
+                    conflicts = [l for l in output if l.startswith('CONFLICT')]
+                    raise MergeConflictException(conflicts)
         except run.RunException, e:
             raise MergeException('Index/worktree dirty')
+    def mergetool(self, files = ()):
+        """Invoke 'git mergetool' on the current IndexAndWorktree to resolve
+        any outstanding conflicts. If 'not files', all the files in an
+        unmerged state will be processed."""
+        err = os.system('git mergetool %s' % ' '.join(files))
+        # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+        # merge())
+        conflicts = ['CONFLICT ' + f for f in self.index.conflicts()]
+        if conflicts:
+            raise MergeConflictException(conflicts)
+        elif err:
+            raise MergeException('"git mergetool" failed, exit code: %d' % err)
     def changed_files(self, tree, pathlimits = []):
         """Return the set of files in the worktree that have changed with
         respect to C{tree}. The listing is optionally restricted to
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 5a81f9d..a918a66 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -8,6 +8,7 @@ from stgit import exception, utils
 from stgit.utils import any, all
 from stgit.out import *
 from stgit.lib import git, log
+from stgit.config import config
 
 class TransactionException(exception.StgException):
     """Exception raised when something goes wrong with a
@@ -296,7 +297,7 @@ class StackTransaction(object):
                     out.info('Deleted %s%s' % (pn, s))
         return popped
 
-    def push_patch(self, pn, iw = None):
+    def push_patch(self, pn, iw = None, allow_interactive = False):
         """Attempt to push the named patch. If this results in conflicts,
         halts the transaction. If index+worktree are given, spill any
         conflicts to them."""
@@ -319,7 +320,9 @@ class StackTransaction(object):
             except git.CheckoutException:
                 self.__halt('Index/worktree dirty')
             try:
-                iw.merge(base, ours, theirs)
+                interactive = allow_interactive and \
+                        config.get('stgit.autoimerge') == 'yes'
+                iw.merge(base, ours, theirs, interactive = interactive)
                 tree = iw.index.write_tree()
                 self.__current_tree = tree
                 s = ' (modified)'

^ permalink raw reply related

* [StGit PATCH 4/5] Convert "sink" to the new infrastructure
From: Catalin Marinas @ 2009-03-12 12:09 UTC (permalink / raw)
  To: git, Karl Hasselström
In-Reply-To: <20090312120426.2992.35213.stgit@pc1117.cambridge.arm.com>

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/sink.py |   86 +++++++++++++++++++++---------------------------
 t/t1501-sink.sh        |    2 +
 2 files changed, 39 insertions(+), 49 deletions(-)

diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py
index d4561ed..8b17fd1 100644
--- a/stgit/commands/sink.py
+++ b/stgit/commands/sink.py
@@ -16,11 +16,10 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os
 from stgit.argparse import opt
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit import argparse, stack, git
+from stgit.commands import common
+from stgit.lib import transaction
+from stgit import argparse
 
 help = 'Send patches deeper down the stack'
 kind = 'stack'
@@ -51,57 +50,48 @@ options = [
     opt('-t', '--to', metavar = 'TARGET', args = [argparse.applied_patches],
         short = 'Sink patches below the TARGET patch', long = """
         Specify a target patch to place the patches below, instead of
-        sinking them to the bottom of the stack.""")]
+        sinking them to the bottom of the stack.""")
+    ] + argparse.keep_option()
 
-directory = DirectoryGotoToplevel(log = True)
+directory = common.DirectoryHasRepositoryLib()
 
 def func(parser, options, args):
     """Sink patches down the stack.
     """
+    stack = directory.repository.current_stack
 
-    check_local_changes()
-    check_conflicts()
-    check_head_top_equal(crt_series)
+    if options.to and not options.to in stack.patchorder.applied:
+        raise common.CmdException('Cannot sink below %s since it is not applied'
+                                  % options.to)
 
-    oldapplied = crt_series.get_applied()
-    unapplied = crt_series.get_unapplied()
-    all = oldapplied + unapplied
+    if len(args) > 0:
+        patches = common.parse_patches(args, stack.patchorder.all)
+    else:
+        # current patch
+        patches = list(stack.patchorder.applied[-1:])
 
-    if options.to and not options.to in oldapplied:
-        raise CmdException('Cannot sink below %s, since it is not applied'
-                           % options.to)
+    if not patches:
+        raise common.CmdException('No patches to sink')
+    if options.to and options.to in patches:
+        raise common.CmdException('Cannot have a sinked patch as target')
 
-    if len(args) > 0:
-        patches = parse_patches(args, all)
+    applied = [p for p in stack.patchorder.applied if p not in patches]
+    if options.to:
+        insert_idx = applied.index(options.to)
     else:
-        current = crt_series.get_current()
-        if not current:
-            raise CmdException('No patch applied')
-        patches = [current]
-
-    before_patches = after_patches = []
-
-    # pop necessary patches
-    if oldapplied:
-        if options.to:
-            pop_idx = oldapplied.index(options.to)
-        else:
-            pop_idx = 0
-        after_patches = [p for p in oldapplied[pop_idx:] if p not in patches]
-
-        # find the deepest patch to pop
-        sink_applied = [p for p in oldapplied if p in patches]
-        if sink_applied:
-            sinked_idx = oldapplied.index(sink_applied[0])
-            if sinked_idx < pop_idx:
-                # this is the case where sink brings patches forward
-                before_patches = [p for p in oldapplied[sinked_idx:pop_idx]
-                                  if p not in patches]
-                pop_idx = sinked_idx
-
-        crt_series.pop_patch(oldapplied[pop_idx])
-
-    push_patches(crt_series, before_patches)
-    push_patches(crt_series, patches)
-    if not options.nopush:
-        push_patches(crt_series, after_patches)
+        insert_idx = 0
+    applied = applied[:insert_idx] + patches + applied[insert_idx:]
+
+    unapplied = [p for p in stack.patchorder.unapplied if p not in patches]
+    hidden = list(stack.patchorder.hidden)
+
+    iw = stack.repository.default_iw
+    clean_iw = not options.keep and iw or None
+    trans = transaction.StackTransaction(stack, 'sink',
+                                         check_clean_iw = clean_iw)
+
+    try:
+        trans.reorder_patches(applied, unapplied, hidden, iw)
+    except transaction.TransactionHalted:
+        pass
+    return trans.run(iw)
diff --git a/t/t1501-sink.sh b/t/t1501-sink.sh
index 516aa44..a0769dd 100755
--- a/t/t1501-sink.sh
+++ b/t/t1501-sink.sh
@@ -58,7 +58,7 @@ test_expect_success 'sink specified patch below a target' '
 '
 
 test_expect_success 'sink with conflict' '
-    conflict_old stg sink --to=p2 p22 &&
+    conflict stg sink --to=p2 p22 &&
     test "$(echo $(stg series --applied --noprefix))" = "p1 p22" &&
     test "$(echo $(stg status -c))" = "f2"
 '

^ permalink raw reply related

* [StGit PATCH 5/5] Convert "float" to the lib infrastructure
From: Catalin Marinas @ 2009-03-12 12:09 UTC (permalink / raw)
  To: git, Karl Hasselström
In-Reply-To: <20090312120426.2992.35213.stgit@pc1117.cambridge.arm.com>

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/float.py |   75 ++++++++++++++++++-----------------------------
 1 files changed, 29 insertions(+), 46 deletions(-)

diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index 7c3dcdf..f94de88 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -16,11 +16,11 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os
+import sys
 from stgit.argparse import opt
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit import argparse, stack, git
+from stgit.commands import common
+from stgit.lib import transaction
+from stgit import argparse
 
 help = 'Push patches to the top, even if applied'
 kind = 'stack'
@@ -36,25 +36,20 @@ args = [argparse.patch_range(argparse.applied_patches,
                              argparse.unapplied_patches)]
 options = [
     opt('-s', '--series', action = 'store_true',
-        short = 'Rearrange according to a series file')]
+        short = 'Rearrange according to a series file')
+    ] + argparse.keep_option()
 
-directory = DirectoryGotoToplevel(log = True)
+directory = common.DirectoryHasRepositoryLib()
 
 def func(parser, options, args):
-    """Pops and pushed to make the named patch the topmost patch
+    """Reorder patches to make the named patch the topmost one.
     """
     args_nr = len(args)
     if (options.series and args_nr > 1) \
            or (not options.series and args_nr == 0):
         parser.error('incorrect number of arguments')
 
-    check_local_changes()
-    check_conflicts()
-    check_head_top_equal(crt_series)
-
-    unapplied = crt_series.get_unapplied()
-    applied = crt_series.get_applied()
-    all = unapplied + applied
+    stack = directory.repository.current_stack
 
     if options.series:
         if args_nr:
@@ -68,35 +63,23 @@ def func(parser, options, args):
             if patch:
                 patches.append(patch)
     else:
-        patches = parse_patches(args, all)
-
-    # working with "topush" patches in reverse order might be a bit
-    # more efficient for large series but the main reason is for the
-    # "topop != topush" comparison to work
-    patches.reverse()
-
-    topush = []
-    topop = []
-
-    for p in patches:
-        while p in applied:
-            top = applied.pop()
-            if not top in patches:
-                topush.append(top)
-            topop.append(top)
-    topush = patches + topush
-
-    # remove common patches to avoid unnecessary pop/push
-    while topush and topop:
-        if topush[-1] != topop[-1]:
-            break
-        topush.pop()
-        topop.pop()
-
-    # check whether the operation is really needed
-    if topop != topush:
-        if topop:
-            pop_patches(crt_series, topop)
-        if topush:
-            topush.reverse()
-            push_patches(crt_series, topush)
+        patches = common.parse_patches(args, stack.patchorder.all)
+
+    if not patches:
+        raise common.CmdException('No patches to float')
+
+    applied = [p for p in stack.patchorder.applied if p not in patches] + \
+            patches
+    unapplied = [p for p in stack.patchorder.unapplied if p not in patches]
+    hidden = list(stack.patchorder.hidden)
+
+    iw = stack.repository.default_iw
+    clean_iw = not options.keep and iw or None
+    trans = transaction.StackTransaction(stack, 'sink',
+                                         check_clean_iw = clean_iw)
+
+    try:
+        trans.reorder_patches(applied, unapplied, hidden, iw)
+    except transaction.TransactionHalted:
+        pass
+    return trans.run(iw)

^ permalink raw reply related

* Re: [RFC/PATCH] git push usability improvements and default change
From: Finn Arne Gangstad @ 2009-03-12 12:20 UTC (permalink / raw)
  To: Miles Bader, '; +Cc: Nanako Shiraishi, Junio C Hamano, git
In-Reply-To: <buomybrqahe.fsf@dhlpc061.dev.necel.com>

On Thu, Mar 12, 2009 at 07:52:29PM +0900, Miles Bader wrote:
> Finn Arne Gangstad <finnag@pvv.org> writes:
> > The main problem with all these examples is that the underlying
> > assumption is that you can always use the same branch name locally and
> > remotely.
> 
> Presumably the push --track option would be used with an explicit branch
> name given to push anyway, right?  Then it can use that info to set up
> the tracking flexibly (and with sane defaults).
> 
> E.g.,, simple case:
> 
>     git push --track SOME_REMOTE BRANCH_NAME
> 
> complex case:
> 
>     git push --track SOME_REMOTE MY-BRANCH:REMOTE-BRANCH

Yes, git push --track ... would typically do the same thing to the
config as git checkout -b MY-BRANCH SOME_REMOTE/REMOTE-BRANCH, which
is enough for push --tracking to do its thing.

I am not sure if you mean that git push --track could do something
extra to make --tracking unecessary for git push, currently it cannot
do that since the push configuration is per remote, not per branch.

- Finn Arne

^ permalink raw reply

* git doc build failure on OS X 10.5.6 (Leopard) during docbook2x-texi  phase
From: Tom Holaday @ 2009-03-12 12:22 UTC (permalink / raw)
  To: git

(Thanks Jay Soffian for the environment variables)

The commands ...

  $ export ASCIIDOC8=YesPlease
  $ export DOCBOOK_XSL_172=YesPlease
  $ make prefix=/usr/local all doc info

... terminate with these errors:

  /bin/sh: docbook2x-texi: command not found [ x 147 ]

... this warning:

  gitman.texi:4: warning: unrecognized encoding name `UTF-8'.

and a zero-length user-manual.texi in Documentation.

Upon investigation, I determined that ...

  $ which docbook2x-texi

... reports empty, but ...

  $ which docbook2texi

... reports /opt/local/bin/docbook2texi.

  $ docbook2texi --version
  /opt/local/bin/docbook2texi (part of docbook2X 0.8.8)
  $Revision: 1.12 $ $Date: 2006/04/14 17:29:04 $
  <URL:http://docbook2x.sourceforge.net/>

Is docbook2texi vs docbook2x-texi a mere dialect difference that can
be completely rectified with a symbolic link, or an indication that my
docbook2X is misbuilt?

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: saurabh gupta @ 2009-03-12 12:42 UTC (permalink / raw)
  To: david; +Cc: Johannes Schindelin, git
In-Reply-To: <alpine.DEB.1.10.0903111307050.16753@asgard.lang.hm>

hello,

On Thu, Mar 12, 2009 at 1:51 AM,  <david@lang.hm> wrote:
>
>> Yes, but the thing is that the underlying codes and method will be
>> different for GUI part and terminal part to make it readable and
>> understandable. Like for OO Documents, if we aim to show the *diff*
>> output in the Office tool, then we have to change the xml file
>> accordingly. But the same xml file when used with terminal only, the
>> *diff* output is not clear.
>>
>> As Johannes said in above post that for OO documents, while showing
>> the *diff* result, no xml data should be shown.
>
> in part we are talking about different aspects of things, and we were all
> wrong.
>
> see the e-mail a little bit ago by Junio
>
> there are two types of helpers that can be written
>
> 1. a low-level part that does the simple merges automaticaly and leaves
> behind appropriate conflict markers when it can't
>
> there is no GUI involved with this.
>
> what 'appropriate conflict markers' are can vary from XML file to XML file
>
>
> 2. after a conflict has taken place, a helper to work with the user to
> resolve the conflict
>
> this can have a GUI and/or a text UI and is tied to the 'appropriate
> conflict markers' as defined in #1, and can be _very_ tightly coupled to the
> specific use of the XML file.
>
> I think it's very important to have a text UI tool that can be used for the
> conflict resolution step as well as supporting GUI tools.

All right. What I can understand from the current situation is that
for merging and marking conflicts in xml (for example) files has
following things to do.

One, if the markers are put in the xml files like that of a text file,
one can see the difference using a text editor or a terminal. But if
the same xml file is to be opened in another editor which expects a
valid xml (as clearly mentioned on the wiki ideas for GIT), then a
merge helper is needed.

But if the conflict markers are put in a way to make the xml file
still valid which can be then opened in the appropriate editor, then
the marking will be different. The merge driver has to produce the
conflicted merged file in a manner which is still a valid xml file and
user has the choice to open it in his own editor to resolve the
conflicts.




-- 
Saurabh Gupta
Senior,
NSIT,New Delhi, India

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: saurabh gupta @ 2009-03-12 12:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: david, Johannes Schindelin, git
In-Reply-To: <7veix33f5e.fsf@gitster.siamese.dyndns.org>

On Thu, Mar 12, 2009 at 3:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> You can cut it both ways.  For an OO document, you do not necessarily need
> any file-level merger at the driver level, but just let the "binary"
> driver declare conflicts and punt.  A merge helper can do all the work
> starting from the "original, ours and theirs" that are not smudged with
> conflict markers.
>
> Between these two extremes, the discussion from other people in the thread
> seemed to all focus too heavily on the "driver punts" approach, forgetting
> that mergetool is useful only because most of the time we do not have to
> even use it, thanks to the fact that "xdl" driver works reasonably well
> for most trivial cases where branches being merged stayed away from each
> other, which is the majority case.  It is a huge win from the productivity
> point of view, and many people might be unaware of it because it is so
> invisible.

If I am not wrong, then for merging two xml files, if we use a simple
xdl merge driver then it will mark the conflicts in the normal way as
it does for simple text files. As far as I can understand, the
following things are supposed to be aimed here taking an example of
xml file:


=>Merging of two xml files

=> existing merge driver (like xdl) is called which marks the
conflicts points just like a normal text file.

=> the conflicted file can be read through a text terminal and
conflicted lines can be seen.

=> suppose the xml file is from the domain of OO document. Then, a
merge helper for OO xml type file is called which takes input as the
conflicted file produced by xdl driver.

=> The merge helper creates a new file or changes the input file to
make it a valid xml file so that it can be opened in OpenOffice and
user can see the markers like "====" or "<<<<<"  in an appropriate
manner and can resolve the file manually.


> When it cannot autoresolve,
> but there is no way to "mark" a tentative result with conflict markers, it
> can do the same thing as the "binary" driver and let the mergetool backend
> handle the "driver punted" case.

I think you mean to say that in case, there is a conflict and the
changes don't overlap, then merge driver leaves the file as it is and
the merge helper will handle the file.


-- 
Saurabh Gupta
Senior,
NSIT,New Delhi, India

^ permalink raw reply

* Re: Deleting remote branch pointed by remote HEAD
From: Felipe Contreras @ 2009-03-12 12:47 UTC (permalink / raw)
  To: Jeff King; +Cc: Daniel Barkalow, Michael J Gruber, Marc-André Lureau, git
In-Reply-To: <20090312113908.GA19572@coredump.intra.peff.net>

On Thu, Mar 12, 2009 at 1:39 PM, Jeff King <peff@peff.net> wrote:
> On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:
>
>> >>   git remote set-default $foo <name>
>> [...]
>> > I think that would be reasonable behavior (and probably a special mode
>> > for set-default to just update from the remote's idea of HEAD).
>>
>> Nobody is working on this, right?
>
> Jay has a number of improvements to "git remote" in next, including
> this. See 104a914 (Merge branch 'js/remote-improvements' into next,
> 2009-03-05). Especially bc14fac (builtin-remote: add set-head
> subcommand, 2009-02-25).

Yes, I looked at that, but set-head will only change the remote HEAD locally.

-- 
Felipe Contreras

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: Michael J Gruber @ 2009-03-12 12:47 UTC (permalink / raw)
  To: saurabh gupta; +Cc: Daniel Barkalow, Johannes Schindelin, git
In-Reply-To: <ab9fa62a0903110958s215a84e6y16b4527ab76cb25b@mail.gmail.com>

saurabh gupta venit, vidit, dixit 11.03.2009 17:58:
> On Wed, Mar 11, 2009 at 9:59 PM, Daniel Barkalow <barkalow@iabervon.org> wrote:
>> On Wed, 11 Mar 2009, saurabh gupta wrote:
>>
>>> On Wed, Mar 11, 2009 at 7:32 PM, Johannes Schindelin
>>> <Johannes.Schindelin@gmx.de> wrote:
>>>> Hi,
>>>>
>>>> On Wed, 11 Mar 2009, saurabh gupta wrote:
>>>>
>>>>> What I think is to implement file formats other than text like that
>>>>> written on wiki i.e. latex, xml, or even any database file (db file).
>>>>> Another idea (although it can be weired also) is to implement the new
>>>>> file formats in the plug-in formats. For example, to incorporate the
>>>>> merger engine for a new file format, a plug-in is created and can be
>>>>> integrated with the present merger in the git. However, I am not sure
>>>>> how much valid is this idea to make the present merger in git to be
>>>>> compatible with the plug-ins for enabling newer file formats.
>>>> I am not sure that a plugin structure is needed.  Take, for example, three
>>>> different .xml based formats: OpenOffice documents, .svg files and Ant
>>>> build.xml files.  They need very different user interfaces.
>>> okay. In that case, if they have  a different user interfaces then
>>> separate plug-in would be needed for each of these. May be this will
>>> get more messy.
>> One thing that I think would be good whenever possible is to have the
>> merge program generate a file in the same format which is easily
>> recognizable as having conflict markers. For example, I think it should be
>> possible to show conflicts in the text of office documents by having
>> styles for each side of the merge, and show each side's content in the
>> appropriate style. Then the user opens the document with their choice of
>> office software, finds the things in the conflict styles, and decides what
>> the result should be.
> Well, I think this is what which is done in case of normal text files
> also. The conflicts put the markers in the file to indicate the
> changes and the modification part. However, in the case of OO
> documents, we have to change the content for the xml file and when it
> is opened in the office software, the user will get the modified
> contents.

OO already knows versioned documents and recording of changes. It can
even merge documents which are different modifications of the same base
document (assuming all authors used recording of changes) and compare
possibly unrelated documents, merging them interactively. At least OO 3
can do that. So I guess for OO one mostly has to figure out how to call
that stuff from the command line. Heck, even MS Office can do that.
Remember those docs with recorded changes, where published documents
contained the deletions as well as the deleted passages?

Michael

^ permalink raw reply

* Re: Deleting remote branch pointed by remote HEAD
From: Jeff King @ 2009-03-12 12:50 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Daniel Barkalow, Michael J Gruber, Marc-André Lureau, git
In-Reply-To: <94a0d4530903120547rfbbaccra8ee68498688fa54@mail.gmail.com>

On Thu, Mar 12, 2009 at 02:47:24PM +0200, Felipe Contreras wrote:

> On Thu, Mar 12, 2009 at 1:39 PM, Jeff King <peff@peff.net> wrote:
> > On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:
> >
> >> >>   git remote set-default $foo <name>
> >> [...]
> >> > I think that would be reasonable behavior (and probably a special mode
> >> > for set-default to just update from the remote's idea of HEAD).
> >>
> >> Nobody is working on this, right?
> >
> > Jay has a number of improvements to "git remote" in next, including
> > this. See 104a914 (Merge branch 'js/remote-improvements' into next,
> > 2009-03-05). Especially bc14fac (builtin-remote: add set-head
> > subcommand, 2009-02-25).
> 
> Yes, I looked at that, but set-head will only change the remote HEAD locally.

That was what the thread you were replying to was about. If you are
proposing a command to set the HEAD in a remote repository, then no, I
don't think anybody is working on that.

-Peff

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: Michael J Gruber @ 2009-03-12 12:56 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Daniel Barkalow, saurabh gupta, git
In-Reply-To: <alpine.DEB.1.00.0903111742360.10498@intel-tinevez-2-302>

Johannes Schindelin venit, vidit, dixit 11.03.2009 17:44:
> Hi,
> 
> On Wed, 11 Mar 2009, Daniel Barkalow wrote:
> 
>> One thing that I think would be good whenever possible is to have the 
>> merge program generate a file in the same format which is easily 
>> recognizable as having conflict markers. For example, I think it should 
>> be possible to show conflicts in the text of office documents by having 
>> styles for each side of the merge, and show each side's content in the 
>> appropriate style. Then the user opens the document with their choice of 
>> office software, finds the things in the conflict styles, and decides 
>> what the result should be.
> That's a very good idea!  (Except for LaTeX, maybe...)

latexdiff (in perl) may give you a head start (or ache, I dunno).

> For SVG, you could add both versions of a modified object, for 
> example, maybe with some visual effect to show the version...

Layers maybe?

I think for most formats, content changes could be handled well, while
changes in macro definitions or global settings are somewhat hopeless.

Michael

^ permalink raw reply

* Re: git checkout -b origin/mybranch origin/mybranch
From: Johannes Schindelin @ 2009-03-12 13:02 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List
In-Reply-To: <43d8ce650903120448x51220ba0k660be7706acba755@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1899 bytes --]

Hi,

On Thu, 12 Mar 2009, John Tapsell wrote:

> 2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > On Thu, 12 Mar 2009, John Tapsell wrote:
> >
> >>   One of my collegues did:
> >>
> >> git checkout origin/somebranch
> >>
> >>   git complained that they need to specify the name with -b.  So they did:
> >>
> >> git checkout -b origin/somebranch origin/somebranch
> >
> > Yeah, a pilot error.  It should have been
> >
> >        $ git checkout -t origin/somebranch
> 
> Maybe the error message for "git checkout origin/somebranch"  should
> suggest:  git checkout -t origin/somebranch?
> 
> > I have to wonder, though, why "git checkout origin/somebranch" did not
> > detach your HEAD.
> 
> It did.  But that doesn't affect doing "git checkout -b
> origin/somebranch origin/somebranch"  afterwards.

So did the warning read something like this?

-- snip --
moving to "d36a18dc9cdf1dfce8632e42491b826387aa3230" which isn't a local 
branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
-- snap --

?

If so, why did you not follow the recipe

	$ git checkout -b somebranch

but something like

	$ git checkout -b origin/somebranch origin/somebranch

?

I do not think there is a way to tell the user more explicitely what to do 
without insulting the user's intelligence ;-)

> > I wonder why you did not just "git branch -m somebranch".
> 
> Because they didn't know what on earth was going on, and git was 
> spitting out errors everywhere, they were afraid git would crash.

Yeah, I know those reactions.  All of a sudden, people panic, destroying 
everything in the process.  Do tell them to calm down first of all.  
Unless you do something like "rm -rf .git" or "git branch -d", it is 
actually pretty hard to lose data with Git.

Ciao,
Dscho

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: Johannes Schindelin @ 2009-03-12 13:07 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Daniel Barkalow, saurabh gupta, git
In-Reply-To: <49B90683.1060501@drmicha.warpmail.net>

Hi,

On Thu, 12 Mar 2009, Michael J Gruber wrote:

> Johannes Schindelin venit, vidit, dixit 11.03.2009 17:44:
> 
> > On Wed, 11 Mar 2009, Daniel Barkalow wrote:
> > 
> >> One thing that I think would be good whenever possible is to have the 
> >> merge program generate a file in the same format which is easily 
> >> recognizable as having conflict markers. For example, I think it 
> >> should be possible to show conflicts in the text of office documents 
> >> by having styles for each side of the merge, and show each side's 
> >> content in the appropriate style. Then the user opens the document 
> >> with their choice of office software, finds the things in the 
> >> conflict styles, and decides what the result should be.
> > That's a very good idea!  (Except for LaTeX, maybe...)
> 
> latexdiff (in perl) may give you a head start (or ache, I dunno).

No.  latexdiff is about diffing.  It does nothing to help me resolve a 
conflict.

Thanks,
Dscho

^ permalink raw reply

* Choosing between "renaming" and "copy"
From: Samuel Tardieu @ 2009-03-12 13:01 UTC (permalink / raw)
  To: git

I renamed a file in my repository, and made a slightly modified copy
of it. It looks like GIT gets confused on which one is the renaming
and which one is the copy, and doesn't favour the 100% identical one
to be chosen as the renaming.

Not a big deal, but maybe git could be more clever here.

% git commit -m "Split into flash and ram alternatives." 
[stm32-sk 601462c] Split into flash and ram alternatives.
 3 files changed, 3 insertions(+), 2 deletions(-)
 copy Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_flash.ld} (100%)
 rename Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_ram.ld} (98%)

% git --version
git version 1.6.2.rc2.305.g23381

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/

^ permalink raw reply

* Re: Google Summer of Code 2009: GIT
From: Michael J Gruber @ 2009-03-12 13:15 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Daniel Barkalow, saurabh gupta, git
In-Reply-To: <alpine.DEB.1.00.0903121407070.6335@intel-tinevez-2-302>

Johannes Schindelin venit, vidit, dixit 12.03.2009 14:07:
> Hi,
> 
> On Thu, 12 Mar 2009, Michael J Gruber wrote:
> 
>> Johannes Schindelin venit, vidit, dixit 11.03.2009 17:44:
>>
>>> On Wed, 11 Mar 2009, Daniel Barkalow wrote:
>>>
>>>> One thing that I think would be good whenever possible is to have the 
>>>> merge program generate a file in the same format which is easily 
>>>> recognizable as having conflict markers. For example, I think it 
>>>> should be possible to show conflicts in the text of office documents 
>>>> by having styles for each side of the merge, and show each side's 
>>>> content in the appropriate style. Then the user opens the document 
>>>> with their choice of office software, finds the things in the 
>>>> conflict styles, and decides what the result should be.
>>> That's a very good idea!  (Except for LaTeX, maybe...)
>> latexdiff (in perl) may give you a head start (or ache, I dunno).
> No.  latexdiff is about diffing.  It does nothing to help me resolve a 
> conflict.

Sure. If you want to merge you have to diff first (and display it). That
would be the "head start". Then you have to think about the merge.
That's where the "head ache" kicks in...

Michael

^ permalink raw reply

* Re: git checkout -b origin/mybranch origin/mybranch
From: John Tapsell @ 2009-03-12 13:18 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git List
In-Reply-To: <alpine.DEB.1.00.0903121357320.6335@intel-tinevez-2-302>

2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Thu, 12 Mar 2009, John Tapsell wrote:
>
>> 2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>>
>> > On Thu, 12 Mar 2009, John Tapsell wrote:
>> >
>> >>   One of my collegues did:
>> >>
>> >> git checkout origin/somebranch
>> >>
>> >>   git complained that they need to specify the name with -b.  So they did:
>> >>
>> >> git checkout -b origin/somebranch origin/somebranch
>> >
>> > Yeah, a pilot error.  It should have been
>> >
>> >        $ git checkout -t origin/somebranch
>>
>> Maybe the error message for "git checkout origin/somebranch"  should
>> suggest:  git checkout -t origin/somebranch?
>>
>> > I have to wonder, though, why "git checkout origin/somebranch" did not
>> > detach your HEAD.
>>
>> It did.  But that doesn't affect doing "git checkout -b
>> origin/somebranch origin/somebranch"  afterwards.
>
> So did the warning read something like this?
>
> -- snip --
> moving to "d36a18dc9cdf1dfce8632e42491b826387aa3230" which isn't a local
> branch
> If you want to create a new branch from this checkout, you may do so
> (now or later) by using -b with the checkout command again. Example:
>  git checkout -b <new_branch_name>
> -- snap --
>
> ?

I'm really not sure what point you're trying to prove.  Yes, we all
know that the user made a mistake in thinking that the new_branch_name
should be "origin/mybranch".

What I'm suggesting is that git tries to not let the user shoot
himself in the foot so easily.

I'm saying that:

git checkout -b origin/mybranch  origin/mybranch

Is probably a mistake by the user.  We should warn the user and point
them in the right direction.

John

^ permalink raw reply

* Re: git checkout -b origin/mybranch origin/mybranch
From: Sverre Rabbelier @ 2009-03-12 13:43 UTC (permalink / raw)
  To: John Tapsell; +Cc: Johannes Schindelin, Git List
In-Reply-To: <43d8ce650903120618h79686207vaa478c54f34e26f8@mail.gmail.com>

Heya,

On Thu, Mar 12, 2009 at 14:18, John Tapsell <johnflux@gmail.com> wrote:
> Is probably a mistake by the user.  We should warn the user and point
> them in the right direction.

The point is that we _already_ warned the user (like Dscho pointed
out), and that(as you pointed out), it didn't work :P.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: git doc build failure on OS X 10.5.6 (Leopard) during xmlto   phase
From: Alejandro Riveira Fernández @ 2009-03-12 14:02 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git, Jay Soffian, Tom Holaday
In-Reply-To: <49B8EF3E.2070208@drmicha.warpmail.net>

El Thu, 12 Mar 2009 12:17:18 +0100
Michael J Gruber <git@drmicha.warpmail.net> escribió:

> Alejandro Riveira venit, vidit, dixit 11.03.2009 21:12:

> >>
> >  "Me too" from a Ubuntu 8.10 Box
> 
> Following up on this:
> On Fedora 10, I have asciidoc 8.2.5 and docbook 1.7.4 xsl's. For proper
> man and html doc, I have to set DOCBOOK_XSL_172=Yes but leave ASCIIDOC8
> unset! I always forget, though (just like the packagers).
> 
> Setting DOCBOOK_XSL_172 shuts off a certain hack which would otherwise
> introduce the notorious .ft in man output.
> 
> Setting ASCIIDOC8 would keep _emphasis_ from being transformed into
> <emphasis>emphasis</emphasis>, which means it would end up as literal
> _emphasis_ in man as well as html.
> 
> Michael
> 
> BTW: Alejandro, please don't cull cc here.

 I'm sorry :[
 In my defense that was using gmane new service via Pan 
 
 Thanks for the explanation on how to workaround the issue

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox