Git development
 help / color / mirror / Atom feed
* Re: git-svn set-tree bug
From: Steven Grimm @ 2007-06-10 23:37 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: 'Eric Wong', 'git'
In-Reply-To: <002a01c7abb6$de2b3680$0e67a8c0@Jocke>

Joakim Tjernlund wrote:
> Is there a way to tell set-tree to commit the whole "merge" branch
> as one svn commit?
> If I merge the latest kernel into my tree there will
> be a lot of commits that I don't want in svn.
>   

You want a "squash" merge. Something like this:

git checkout -b tempbranch origin/svn-branch-to-commit-merge-to
git merge --squash branch-with-commits-you-want-to-merge
git commit
git svn dcommit

The "merge" command will merge in the changes but will not commit 
anything; when you do the explicit "commit" command afterwards, you get 
the contents of the merge but from git's point of view it's just a 
regular commit so git-svn doesn't get confused.

After you do git svn dcommit, you may want to edit .git/info/grafts to 
tell git after the fact that this commit was a merge. It won't hurt 
git-svn at that point and it will mean you can do another merge later 
without git getting confused about what has already been merged.

Take a look at the script I posted a while back, which does something 
similar:

http://www.spinics.net/lists/git/msg29119.html

-Steve

^ permalink raw reply

* RE: git-svn set-tree bug
From: Joakim Tjernlund @ 2007-06-10 23:55 UTC (permalink / raw)
  To: 'Steven Grimm'; +Cc: 'Eric Wong', 'git'
In-Reply-To: <466C8B35.3020207@midwinter.com>

 

> -----Original Message-----
> From: Steven Grimm [mailto:koreth@midwinter.com] 
> Sent: den 11 juni 2007 01:37
> To: Joakim Tjernlund
> Cc: 'Eric Wong'; 'git'
> Subject: Re: git-svn set-tree bug
> 
> Joakim Tjernlund wrote:
> > Is there a way to tell set-tree to commit the whole "merge" branch
> > as one svn commit?
> > If I merge the latest kernel into my tree there will
> > be a lot of commits that I don't want in svn.
> >   
> 
> You want a "squash" merge. Something like this:
> 
> git checkout -b tempbranch origin/svn-branch-to-commit-merge-to
> git merge --squash branch-with-commits-you-want-to-merge
> git commit
> git svn dcommit
> 
> The "merge" command will merge in the changes but will not commit 
> anything; when you do the explicit "commit" command 
> afterwards, you get 
> the contents of the merge but from git's point of view it's just a 
> regular commit so git-svn doesn't get confused.
> 
> After you do git svn dcommit, you may want to edit 
> .git/info/grafts to 
> tell git after the fact that this commit was a merge. It won't hurt 
> git-svn at that point and it will mean you can do another merge later 
> without git getting confused about what has already been merged.
> 
> Take a look at the script I posted a while back, which does something 
> similar:
> 
> http://www.spinics.net/lists/git/msg29119.html
> 

Hi Steven

That looks promising, especially Junos comment about making git-svn
able to deal with merges. Eric, do you feel this is doable?

 Jocke 

^ permalink raw reply

* [PATCH 0/5] misc. submodule related changes
From: Lars Hjemli @ 2007-06-10 23:59 UTC (permalink / raw)
  To: git@vger.kernel.org

Here is a reworked patch-series for git-submodule, trying to cater for
the issues with the previous series.

Shortlog:
  [1/5] t7400: barf if git-submodule removes or replaces a file
  [2/5] git-submodule: remember to checkout after clone
  [3/5] Rename sections from "module" to "submodule" in .gitmodules
  [4/5] git-submodule: give submodules proper names
  [5/5] Add gitmodules(5)

Diffstat:
Documentation/Makefile       |    2 +-
Documentation/gitmodules.txt |   63 ++++++++++++++++++++++++++++++++++++++++++
git-submodule.sh             |   52 +++++++++++++++++++++++-----------
t/t7400-submodule-basic.sh   |   22 +++++++++++---
4 files changed, 116 insertions(+), 23 deletions(-)

^ permalink raw reply

* [PATCH 1/5] t7400: barf if git-submodule removes or replaces a file
From: Lars Hjemli @ 2007-06-11  0:00 UTC (permalink / raw)
  To: git@vger.kernel.org

The test for an unmolested file wouldn't fail properly if the file had been
removed or replaced by something other than a regular file. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
  t/t7400-submodule-basic.sh |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 3940433..74fafce 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -72,7 +72,7 @@ test_expect_success 'update should fail when path is used by a file' '
  	then
  		echo "[OOPS] update should have failed"
  		false
-	elif test -f lib && test "$(cat lib)" != "hello"
+	elif test "$(cat lib)" != "hello"
  	then
  		echo "[OOPS] update failed but lib file was molested"
  		false
-- 
1.5.2.1.914.gbd3a7

^ permalink raw reply related

* [PATCH 2/5] git-submodule: remember to checkout after clone
From: Lars Hjemli @ 2007-06-11  0:01 UTC (permalink / raw)
  To: git@vger.kernel.org

After the initial clone of a submodule, no files would be checked out in
the submodule directory if the submodule HEAD was equal to the SHA-1
specified in the index of the containing repository. This fixes the problem
by simply ignoring submodule HEAD for a fresh clone.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
  git-submodule.sh |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 8bdd99a..4a6d64d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -100,12 +100,13 @@ modules_update()
  		if ! test -d "$path"/.git
  		then
  			module_clone "$path" "$url" || exit
+			subsha1=
+		else
+			subsha1=$(unset GIT_DIR && cd "$path" &&
+				git-rev-parse --verify HEAD) ||
+			die "Unable to find current revision of submodule '$path'"
  		fi

-		subsha1=$(unset GIT_DIR && cd "$path" &&
-			git-rev-parse --verify HEAD) ||
-		die "Unable to find current revision of submodule '$path'"
-
  		if test "$subsha1" != "$sha1"
  		then
  			(unset GIT_DIR && cd "$path" && git-fetch &&
-- 
1.5.2.1.914.gbd3a7

^ permalink raw reply related

* [PATCH 3/5] Rename sections from "module" to "submodule" in .gitmodules
From: Lars Hjemli @ 2007-06-11  0:01 UTC (permalink / raw)
  To: git@vger.kernel.org

On 6/10/07, Junio C Hamano <gitster@pobox.com> wrote:
> "Lars Hjemli" <hjemli@gmail.com> writes:
>
> > Hmm, maybe I should just rename [module] to [submodule] right now? It
> > would be better forward compatible with the proposed extension, it
> > would 'harmonize' the section names used in .gitmodules and
> > .git/config, and it would offer a clean break from what's currently
> > supported in 'master'.
>
> Yes, the difference between '[submodule]' vs '[module]' in
> .git/config and .gitmodules confused me while looking at your
> latest patch series.  I am in favor of unifying them.  We would
> not be breaking any released version if we harmonize them now.

Here it is.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
  git-submodule.sh           |    2 +-
  t/t7400-submodule-basic.sh |    2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 4a6d64d..6c83c52 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -66,7 +66,7 @@ modules_init()
  		url=$(git-config submodule."$path".url)
  		test -z "$url" || continue

-		url=$(GIT_CONFIG=.gitmodules git-config module."$path".url)
+		url=$(GIT_CONFIG=.gitmodules git-config submodule."$path".url)
  		test -z "$url" &&
  		die "No url found for submodule '$path' in .gitmodules"

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 74fafce..9f2d4f9 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -40,7 +40,7 @@ test_expect_success 'Prepare submodule testing' '
  	git-add a lib z &&
  	git-commit -m "super commit 1" &&
  	mv lib .subrepo &&
-	GIT_CONFIG=.gitmodules git-config module.lib.url git://example.com/lib.git
+	GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git
  '

  test_expect_success 'status should only print one line' '
-- 
1.5.2.1.914.gbd3a7

^ permalink raw reply related

* [PATCH 4/5] git-submodule: give submodules proper names
From: Lars Hjemli @ 2007-06-11  0:03 UTC (permalink / raw)
  To: git@vger.kernel.org

This changes the way git-submodule uses .gitmodules: Subsections no longer
specify the submodule path, they now specify the submodule name. The
submodule path is found under the new key "submodule.<name>.path", which is
a required key.

With this change a submodule can be moved between different 'checkout paths'
without upsetting git-submodule.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
  git-submodule.sh           |   45 ++++++++++++++++++++++++++++++-------------
  t/t7400-submodule-basic.sh |   20 +++++++++++++++---
  2 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 6c83c52..89a3885 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -25,6 +25,19 @@ say()
  	fi
  }

+#
+# Map submodule path to submodule name
+#
+# $1 = path
+#
+module_name()
+{
+       name=$(GIT_CONFIG=.gitmodules git-config --get-regexp '^submodule\..*\.path$' "$1" |
+       sed -nre 's/^submodule\.(.+)\.path .+$/\1/p')
+       test -z "$name" &&
+       die "No submodule mapping found in .gitmodules for path '$path'"
+       echo "$name"
+}

  #
  # Clone a submodule
@@ -49,7 +62,7 @@ module_clone()
  	die "A file already exist at path '$path'"

  	git-clone -n "$url" "$path" ||
-	die "Clone of submodule '$path' failed"
+	die "Clone of '$url' into submodule path '$path' failed"
  }

  #
@@ -63,17 +76,18 @@ modules_init()
  	while read mode sha1 stage path
  	do
  		# Skip already registered paths
-		url=$(git-config submodule."$path".url)
+		name=$(module_name "$path") || exit
+		url=$(git-config submodule."$name".url)
  		test -z "$url" || continue

-		url=$(GIT_CONFIG=.gitmodules git-config submodule."$path".url)
+		url=$(GIT_CONFIG=.gitmodules git-config submodule."$name".url)
  		test -z "$url" &&
-		die "No url found for submodule '$path' in .gitmodules"
+		die "No url found for submodule path '$path' in .gitmodules"

-		git-config submodule."$path".url "$url" ||
-		die "Failed to register url for submodule '$path'"
+		git-config submodule."$name".url "$url" ||
+		die "Failed to register url for submodule path '$path'"

-		say "Submodule '$path' registered with url '$url'"
+		say "Submodule '$name' ($url) registered for path '$path'"
  	done
  }

@@ -87,13 +101,14 @@ modules_update()
  	git ls-files --stage -- "$@" | grep -e '^160000 ' |
  	while read mode sha1 stage path
  	do
-		url=$(git-config submodule."$path".url)
+		name=$(module_name "$path") || exit
+		url=$(git-config submodule."$name".url)
  		if test -z "$url"
  		then
  			# Only mention uninitialized submodules when its
  			# path have been specified
  			test "$#" != "0" &&
-			say "Submodule '$path' not initialized"
+			say "Submodule path '$path' not initialized"
  			continue
  		fi

@@ -104,22 +119,22 @@ modules_update()
  		else
  			subsha1=$(unset GIT_DIR && cd "$path" &&
  				git-rev-parse --verify HEAD) ||
-			die "Unable to find current revision of submodule '$path'"
+			die "Unable to find current revision in submodule path '$path'"
  		fi

  		if test "$subsha1" != "$sha1"
  		then
  			(unset GIT_DIR && cd "$path" && git-fetch &&
  				git-checkout -q "$sha1") ||
-			die "Unable to checkout '$sha1' in submodule '$path'"
+			die "Unable to checkout '$sha1' in submodule path '$path'"

-			say "Submodule '$path': checked out '$sha1'"
+			say "Submodule path '$path': checked out '$sha1'"
  		fi
  	done
  }

  #
-# List all registered submodules, prefixed with:
+# List all submodules, prefixed with:
  #  - submodule not initialized
  #  + different revision checked out
  #
@@ -133,7 +148,9 @@ modules_list()
  	git ls-files --stage -- "$@" | grep -e '^160000 ' |
  	while read mode sha1 stage path
  	do
-		if ! test -d "$path"/.git
+		name=$(module_name "$path") || exit
+		url=$(git-config submodule."$name".url)
+		if test -z "url" || ! test -d "$path"/.git
  		then
  			say "-$sha1 $path"
  			continue;
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 9f2d4f9..7a9b505 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -18,7 +18,7 @@ subcommands of git-submodule.
  #  -add directory lib to 'superproject', this creates a DIRLINK entry
  #  -add a couple of regular files to enable testing of submodule filtering
  #  -mv lib subrepo
-#  -add an entry to .gitmodules for path 'lib'
+#  -add an entry to .gitmodules for submodule 'example'
  #
  test_expect_success 'Prepare submodule testing' '
  	mkdir lib &&
@@ -40,7 +40,19 @@ test_expect_success 'Prepare submodule testing' '
  	git-add a lib z &&
  	git-commit -m "super commit 1" &&
  	mv lib .subrepo &&
-	GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git
+	GIT_CONFIG=.gitmodules git-config submodule.example.url git://example.com/lib.git
+'
+
+test_expect_success 'status should fail for unmapped paths' '
+	if git-submodule status
+	then
+		echo "[OOPS] submodule status succeeded"
+		false
+	elif ! GIT_CONFIG=.gitmodules git-config submodule.example.path lib
+	then
+		echo "[OOPS] git-config failed to update .gitmodules"
+		false
+	fi
  '

  test_expect_success 'status should only print one line' '
@@ -54,12 +66,12 @@ test_expect_success 'status should initially be "missing"' '

  test_expect_success 'init should register submodule url in .git/config' '
  	git-submodule init &&
-	url=$(git-config submodule.lib.url) &&
+	url=$(git-config submodule.example.url) &&
  	if test "$url" != "git://example.com/lib.git"
  	then
  		echo "[OOPS] init succeeded but submodule url is wrong"
  		false
-	elif ! git-config submodule.lib.url ./.subrepo
+	elif ! git-config submodule.example.url ./.subrepo
  	then
  		echo "[OOPS] init succeeded but update of url failed"
  		false
-- 
1.5.2.1.914.gbd3a7

^ permalink raw reply related

* [PATCH 5/5] Add gitmodules(5)
From: Lars Hjemli @ 2007-06-11  0:04 UTC (permalink / raw)
  To: git@vger.kernel.org

This adds documentation for the .gitmodules file.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
  Documentation/Makefile       |    2 +-
  Documentation/gitmodules.txt |   62 ++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 63 insertions(+), 1 deletions(-)
  create mode 100644 Documentation/gitmodules.txt

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9cef480..2ad18e0 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -2,7 +2,7 @@ MAN1_TXT= \
  	$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
  		$(wildcard git-*.txt)) \
  	gitk.txt
-MAN5_TXT=gitattributes.txt gitignore.txt
+MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
  MAN7_TXT=git.txt

  DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
new file mode 100644
index 0000000..6c7d9bf
--- /dev/null
+++ b/Documentation/gitmodules.txt
@@ -0,0 +1,62 @@
+gitmodules(5)
+=============
+
+NAME
+----
+gitmodules - defining submodule properties
+
+SYNOPSIS
+--------
+.gitmodules
+
+
+DESCRIPTION
+-----------
+
+The `.gitmodules` file, located in the top-level directory of a git
+working tree, is a text file with a syntax matching the requirements
+of gitlink:git-config[1].
+
+The file contains one subsection per submodule, and the subsection value
+is the name of the submodule. Each submodule section also contains the
+following required keys:
+
+submodule.<name>.path::
+	Defines the path, relative to the top-level directory of the git
+	working tree, where the submodule is expected to be checked out.
+	The path name must not end with a `/`. All submodule paths must
+	be unique within the .gitmodules file.
+
+submodule.<name>.url::
+	Defines an url from where the submodule repository can be cloned.
+
+
+EXAMPLES
+--------
+
+Consider the following .gitmodules file:
+
+	[submodule 'libfoo']
+		path = include/foo
+		url = git://foo.com/git/lib.git
+
+	[submodule 'libbar']
+		path = include/bar
+		url = git://bar.com/git/lib.git
+
+
+This defines two submodules, `libfoo` and `libbar`. These are expected to
+be checked out in the paths 'include/foo' and 'include/bar', and for both
+submodules an url is specified which can be used for cloning the submodules.
+
+SEE ALSO
+--------
+gitlink:git-submodule[1] gitlink:git-config[1]
+
+DOCUMENTATION
+-------------
+Documentation by Lars Hjemli <hjemli@gmail.com>
+
+GIT
+---
+Part of the gitlink:git[7] suite
-- 
1.5.2.1.914.gbd3a7

^ permalink raw reply related

* [StGIT PATCH 1/4] Use get/set_name for a stack's name.
From: Yann Dirson @ 2007-06-11  0:33 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git
In-Reply-To: <20070611003117.4736.33551.stgit@gandelf.nowhere.earth>

It is much more clear to use get_name() than get_branch(), and this is
a step towards factoring stuff into a PatchSet class.
---

 stgit/commands/branch.py |   12 +++---
 stgit/commands/export.py |    2 +
 stgit/commands/pull.py   |    2 +
 stgit/commands/series.py |    2 +
 stgit/commands/sync.py   |    2 +
 stgit/stack.py           |   88 +++++++++++++++++++++++-----------------------
 6 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py
index 07bdca8..c22e143 100644
--- a/stgit/commands/branch.py
+++ b/stgit/commands/branch.py
@@ -68,7 +68,7 @@ options = [make_option('-c', '--create',
 
 
 def __is_current_branch(branch_name):
-    return crt_series.get_branch() == branch_name
+    return crt_series.get_name() == branch_name
 
 def __print_branch(branch_name, length):
     initialized = ' '
@@ -168,7 +168,7 @@ def func(parser, options, args):
     elif options.clone:
 
         if len(args) == 0:
-            clone = crt_series.get_branch() + \
+            clone = crt_series.get_name() + \
                     time.strftime('-%C%y%m%d-%H%M%S')
         elif len(args) == 1:
             clone = args[0]
@@ -215,7 +215,7 @@ def func(parser, options, args):
     elif options.protect:
 
         if len(args) == 0:
-            branch_name = crt_series.get_branch()
+            branch_name = crt_series.get_name()
         elif len(args) == 1:
             branch_name = args[0]
         else:
@@ -249,7 +249,7 @@ def func(parser, options, args):
     elif options.unprotect:
 
         if len(args) == 0:
-            branch_name = crt_series.get_branch()
+            branch_name = crt_series.get_name()
         elif len(args) == 1:
             branch_name = args[0]
         else:
@@ -269,7 +269,7 @@ def func(parser, options, args):
     elif options.description is not None:
 
         if len(args) == 0:
-            branch_name = crt_series.get_branch()
+            branch_name = crt_series.get_name()
         elif len(args) == 1:
             branch_name = args[0]
         else:
@@ -303,4 +303,4 @@ def func(parser, options, args):
     if len(args) != 0:
         parser.error('incorrect number of arguments')
 
-    print crt_series.get_branch()
+    print crt_series.get_name()
diff --git a/stgit/commands/export.py b/stgit/commands/export.py
index 35851bc..8424f9d 100644
--- a/stgit/commands/export.py
+++ b/stgit/commands/export.py
@@ -75,7 +75,7 @@ def func(parser, options, args):
     if options.dir:
         dirname = options.dir
     else:
-        dirname = 'patches-%s' % crt_series.get_branch()
+        dirname = 'patches-%s' % crt_series.get_name()
 
     if not options.branch and git.local_changes():
         out.warn('Local changes in the tree;'
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index beaa7b5..5f72f9b 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -50,7 +50,7 @@ options = [make_option('-n', '--nopush',
 def func(parser, options, args):
     """Pull the changes from a remote repository
     """
-    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \
+    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_name()) or \
              config.get('stgit.pull-policy')
 
     if policy == 'rebase':
diff --git a/stgit/commands/series.py b/stgit/commands/series.py
index fe4e468..0b3efe0 100644
--- a/stgit/commands/series.py
+++ b/stgit/commands/series.py
@@ -181,7 +181,7 @@ def func(parser, options, args):
         return
 
     if options.showbranch:
-        branch_str = '@' + crt_series.get_branch()
+        branch_str = '@' + crt_series.get_name()
     else:
         branch_str = ''
 
diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py
index 8359061..e769602 100644
--- a/stgit/commands/sync.py
+++ b/stgit/commands/sync.py
@@ -85,7 +85,7 @@ def func(parser, options, args):
         # branch
         remote_series = crt_series
         stgit.commands.common.crt_series = crt_series = stack.Series()
-        if options.branch == crt_series.get_branch():
+        if options.branch == crt_series.get_name():
             raise CmdException, 'Cannot synchronise with the current branch'
         remote_patches = remote_series.get_applied()
 
diff --git a/stgit/stack.py b/stgit/stack.py
index a64aff6..0d475da 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -356,21 +356,21 @@ class Series(StgitObject):
         """
         try:
             if name:
-                self.__name = name
+                self.set_name (name)
             else:
-                self.__name = git.get_head_file()
+                self.set_name (git.get_head_file())
             self.__base_dir = basedir.get()
         except git.GitException, ex:
             raise StackException, 'GIT tree not initialised: %s' % ex
 
-        self._set_dir(os.path.join(self.__base_dir, 'patches', self.__name))
+        self._set_dir(os.path.join(self.__base_dir, 'patches', self.get_name()))
 
         # Update the branch to the latest format version if it is
         # initialized, but don't touch it if it isn't.
-        update_to_current_format_version(self.__name, self.__base_dir)
+        update_to_current_format_version(self.get_name(), self.__base_dir)
 
         self.__refs_dir = os.path.join(self.__base_dir, 'refs', 'patches',
-                                       self.__name)
+                                       self.get_name())
 
         self.__applied_file = os.path.join(self._dir(), 'applied')
         self.__unapplied_file = os.path.join(self._dir(), 'unapplied')
@@ -388,11 +388,11 @@ class Series(StgitObject):
         if not name or re.search('[^\w.-]', name):
             raise StackException, 'Invalid patch name: "%s"' % name
 
-    def get_branch(self):
-        """Return the branch name for the Series object
-        """
+    def get_name(self):
         return self.__name
-
+    def set_name(self, name):
+        self.__name = name
+        
     def get_patch(self, name):
         """Return a Patch object for the given name
         """
@@ -422,12 +422,12 @@ class Series(StgitObject):
 
     def get_applied(self):
         if not os.path.isfile(self.__applied_file):
-            raise StackException, 'Branch "%s" not initialised' % self.__name
+            raise StackException, 'Branch "%s" not initialised' % self.get_name()
         return read_strings(self.__applied_file)
 
     def get_unapplied(self):
         if not os.path.isfile(self.__unapplied_file):
-            raise StackException, 'Branch "%s" not initialised' % self.__name
+            raise StackException, 'Branch "%s" not initialised' % self.get_name()
         return read_strings(self.__unapplied_file)
 
     def get_hidden(self):
@@ -467,7 +467,7 @@ class Series(StgitObject):
             os.remove(protect_file)
 
     def __branch_descr(self):
-        return 'branch.%s.description' % self.get_branch()
+        return 'branch.%s.description' % self.get_name()
 
     def get_description(self):
         return config.get(self.__branch_descr()) or ''
@@ -479,41 +479,41 @@ class Series(StgitObject):
             config.unset(self.__branch_descr())
 
     def get_parent_remote(self):
-        value = config.get('branch.%s.remote' % self.__name)
+        value = config.get('branch.%s.remote' % self.get_name())
         if value:
             return value
         elif 'origin' in git.remotes_list():
             out.note(('No parent remote declared for stack "%s",'
-                      ' defaulting to "origin".' % self.__name),
+                      ' defaulting to "origin".' % self.get_name()),
                      ('Consider setting "branch.%s.remote" and'
                       ' "branch.%s.merge" with "git repo-config".'
-                      % (self.__name, self.__name)))
+                      % (self.get_name(), self.get_name())))
             return 'origin'
         else:
-            raise StackException, 'Cannot find a parent remote for "%s"' % self.__name
+            raise StackException, 'Cannot find a parent remote for "%s"' % self.get_name()
 
     def __set_parent_remote(self, remote):
-        value = config.set('branch.%s.remote' % self.__name, remote)
+        value = config.set('branch.%s.remote' % self.get_name(), remote)
 
     def get_parent_branch(self):
-        value = config.get('branch.%s.stgit.parentbranch' % self.__name)
+        value = config.get('branch.%s.stgit.parentbranch' % self.get_name())
         if value:
             return value
         elif git.rev_parse('heads/origin'):
             out.note(('No parent branch declared for stack "%s",'
-                      ' defaulting to "heads/origin".' % self.__name),
+                      ' defaulting to "heads/origin".' % self.get_name()),
                      ('Consider setting "branch.%s.stgit.parentbranch"'
-                      ' with "git repo-config".' % self.__name))
+                      ' with "git repo-config".' % self.get_name()))
             return 'heads/origin'
         else:
-            raise StackException, 'Cannot find a parent branch for "%s"' % self.__name
+            raise StackException, 'Cannot find a parent branch for "%s"' % self.get_name()
 
     def __set_parent_branch(self, name):
-        if config.get('branch.%s.remote' % self.__name):
+        if config.get('branch.%s.remote' % self.get_name()):
             # Never set merge if remote is not set to avoid
             # possibly-erroneous lookups into 'origin'
-            config.set('branch.%s.merge' % self.__name, name)
-        config.set('branch.%s.stgit.parentbranch' % self.__name, name)
+            config.set('branch.%s.merge' % self.get_name(), name)
+        config.set('branch.%s.stgit.parentbranch' % self.get_name(), name)
 
     def set_parent(self, remote, localbranch):
         if localbranch:
@@ -521,7 +521,7 @@ class Series(StgitObject):
             self.__set_parent_branch(localbranch)
         # We'll enforce this later
 #         else:
-#             raise StackException, 'Parent branch (%s) should be specified for %s' % localbranch, self.__name
+#             raise StackException, 'Parent branch (%s) should be specified for %s' % localbranch, self.get_name()
 
     def __patch_is_current(self, patch):
         return patch.get_name() == self.get_current()
@@ -559,19 +559,19 @@ class Series(StgitObject):
     def is_initialised(self):
         """Checks if series is already initialised
         """
-        return bool(config.get(format_version_key(self.get_branch())))
+        return bool(config.get(format_version_key(self.get_name())))
 
     def init(self, create_at=False, parent_remote=None, parent_branch=None):
         """Initialises the stgit series
         """
         if self.is_initialised():
-            raise StackException, '%s already initialized' % self.get_branch()
+            raise StackException, '%s already initialized' % self.get_name()
         for d in [self._dir(), self.__refs_dir]:
             if os.path.exists(d):
                 raise StackException, '%s already exists' % d
 
         if (create_at!=False):
-            git.create_branch(self.__name, create_at)
+            git.create_branch(self.get_name(), create_at)
 
         os.makedirs(self.__patch_dir)
 
@@ -582,7 +582,7 @@ class Series(StgitObject):
         os.makedirs(self.__refs_dir)
         self._set_field('orig-base', git.get_head())
 
-        config.set(format_version_key(self.get_branch()), str(FORMAT_VERSION))
+        config.set(format_version_key(self.get_name()), str(FORMAT_VERSION))
 
     def rename(self, to_name):
         """Renames a series
@@ -590,19 +590,19 @@ class Series(StgitObject):
         to_stack = Series(to_name)
 
         if to_stack.is_initialised():
-            raise StackException, '"%s" already exists' % to_stack.get_branch()
+            raise StackException, '"%s" already exists' % to_stack.get_name()
 
-        git.rename_branch(self.__name, to_name)
+        git.rename_branch(self.get_name(), to_name)
 
         if os.path.isdir(self._dir()):
             rename(os.path.join(self.__base_dir, 'patches'),
-                   self.__name, to_stack.__name)
+                   self.get_name(), to_stack.get_name())
         if os.path.exists(self.__refs_dir):
             rename(os.path.join(self.__base_dir, 'refs', 'patches'),
-                   self.__name, to_stack.__name)
+                   self.get_name(), to_stack.get_name())
 
         # Rename the config section
-        config.rename_section("branch.%s" % self.__name,
+        config.rename_section("branch.%s" % self.get_name(),
                               "branch.%s" % to_name)
 
         self.__init__(to_name)
@@ -619,7 +619,7 @@ class Series(StgitObject):
         new_series = Series(target_series)
 
         # generate an artificial description file
-        new_series.set_description('clone of "%s"' % self.__name)
+        new_series.set_description('clone of "%s"' % self.get_name())
 
         # clone self's entire series as unapplied patches
         try:
@@ -649,15 +649,15 @@ class Series(StgitObject):
         new_series.forward_patches(applied)
 
         # Clone parent informations
-        value = config.get('branch.%s.remote' % self.__name)
+        value = config.get('branch.%s.remote' % self.get_name())
         if value:
             config.set('branch.%s.remote' % target_series, value)
 
-        value = config.get('branch.%s.merge' % self.__name)
+        value = config.get('branch.%s.merge' % self.get_name())
         if value:
             config.set('branch.%s.merge' % target_series, value)
 
-        value = config.get('branch.%s.stgit.parentbranch' % self.__name)
+        value = config.get('branch.%s.stgit.parentbranch' % self.get_name())
         if value:
             config.set('branch.%s.stgit.parentbranch' % target_series, value)
 
@@ -708,10 +708,10 @@ class Series(StgitObject):
         # Cleanup parent informations
         # FIXME: should one day make use of git-config --section-remove,
         # scheduled for 1.5.1
-        config.unset('branch.%s.remote' % self.__name)
-        config.unset('branch.%s.merge' % self.__name)
-        config.unset('branch.%s.stgit.parentbranch' % self.__name)
-        config.unset('branch.%s.stgitformatversion' % self.__name)
+        config.unset('branch.%s.remote' % self.get_name())
+        config.unset('branch.%s.merge' % self.get_name())
+        config.unset('branch.%s.stgit.parentbranch' % self.get_name())
+        config.unset('branch.%s.stgitformatversion' % self.get_name())
 
     def refresh_patch(self, files = None, message = None, edit = False,
                       show_patch = False,
@@ -1093,13 +1093,13 @@ class Series(StgitObject):
 
         patch = Patch(name, self.__patch_dir, self.__refs_dir)
 
-        if git.get_head_file() == self.get_branch():
+        if git.get_head_file() == self.get_name():
             if keep and not git.apply_diff(git.get_head(), patch.get_bottom()):
                 raise StackException(
                     'Failed to pop patches while preserving the local changes')
             git.switch(patch.get_bottom(), keep)
         else:
-            git.set_branch(self.get_branch(), patch.get_bottom())
+            git.set_branch(self.get_name(), patch.get_bottom())
 
         # save the new applied list
         idx = applied.index(name) + 1

^ permalink raw reply related

* [StGIT PATCH 0/4] Cleanups of the Series object.
From: Yann Dirson @ 2007-06-11  0:33 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

These cleanups and under-the-hood evolutions are mostly driven by my
(still preliminar) work at allowing to work on several stacks at a
time using hydras.

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

^ permalink raw reply

* [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.
From: Yann Dirson @ 2007-06-11  0:33 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git
In-Reply-To: <20070611003117.4736.33551.stgit@gandelf.nowhere.earth>

The goal is to move into PatchSet all functionnality that is not
dependant of Series being a real stack, paving the way for handling
parallel (hydra) stacks, or any other way to organize patches.
---

 stgit/stack.py |  110 +++++++++++++++++++++++++++++---------------------------
 1 files changed, 56 insertions(+), 54 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
index 0d475da..35840e2 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -348,7 +348,62 @@ def update_to_current_format_version(branch, git_dir):
         raise StackException('Branch %s is at format version %d, expected %d'
                              % (branch, get_format_version(), FORMAT_VERSION))
 
-class Series(StgitObject):
+class PatchSet(StgitObject):
+    def get_name(self):
+        return self.__name
+    def set_name(self, name):
+        self.__name = name
+
+    def get_head(self):
+        """Return the head of the branch
+        """
+        crt = self.get_current_patch()
+        if crt:
+            return crt.get_top()
+        else:
+            return self.get_base()
+
+    def get_protected(self):
+        return os.path.isfile(os.path.join(self._dir(), 'protected'))
+
+    def protect(self):
+        protect_file = os.path.join(self._dir(), 'protected')
+        if not os.path.isfile(protect_file):
+            create_empty_file(protect_file)
+
+    def unprotect(self):
+        protect_file = os.path.join(self._dir(), 'protected')
+        if os.path.isfile(protect_file):
+            os.remove(protect_file)
+
+    def __branch_descr(self):
+        return 'branch.%s.description' % self.get_name()
+
+    def get_description(self):
+        return config.get(self.__branch_descr()) or ''
+
+    def set_description(self, line):
+        if line:
+            config.set(self.__branch_descr(), line)
+        else:
+            config.unset(self.__branch_descr())
+
+    def head_top_equal(self):
+        """Return true if the head and the top are the same
+        """
+        crt = self.get_current_patch()
+        if not crt:
+            # we don't care, no patches applied
+            return True
+        return git.get_head() == crt.get_top()
+
+    def is_initialised(self):
+        """Checks if series is already initialised
+        """
+        return bool(config.get(format_version_key(self.get_name())))
+
+
+class Series(PatchSet):
     """Class including the operations on series
     """
     def __init__(self, name = None):
@@ -388,11 +443,6 @@ class Series(StgitObject):
         if not name or re.search('[^\w.-]', name):
             raise StackException, 'Invalid patch name: "%s"' % name
 
-    def get_name(self):
-        return self.__name
-    def set_name(self, name):
-        self.__name = name
-        
     def get_patch(self, name):
         """Return a Patch object for the given name
         """
@@ -444,40 +494,6 @@ class Series(StgitObject):
         # No bottommost patch, so just return HEAD
         return git.get_head()
 
-    def get_head(self):
-        """Return the head of the branch
-        """
-        crt = self.get_current_patch()
-        if crt:
-            return crt.get_top()
-        else:
-            return self.get_base()
-
-    def get_protected(self):
-        return os.path.isfile(os.path.join(self._dir(), 'protected'))
-
-    def protect(self):
-        protect_file = os.path.join(self._dir(), 'protected')
-        if not os.path.isfile(protect_file):
-            create_empty_file(protect_file)
-
-    def unprotect(self):
-        protect_file = os.path.join(self._dir(), 'protected')
-        if os.path.isfile(protect_file):
-            os.remove(protect_file)
-
-    def __branch_descr(self):
-        return 'branch.%s.description' % self.get_name()
-
-    def get_description(self):
-        return config.get(self.__branch_descr()) or ''
-
-    def set_description(self, line):
-        if line:
-            config.set(self.__branch_descr(), line)
-        else:
-            config.unset(self.__branch_descr())
-
     def get_parent_remote(self):
         value = config.get('branch.%s.remote' % self.get_name())
         if value:
@@ -547,20 +563,6 @@ class Series(StgitObject):
         return self.patch_applied(name) or self.patch_unapplied(name) \
                or self.patch_hidden(name)
 
-    def head_top_equal(self):
-        """Return true if the head and the top are the same
-        """
-        crt = self.get_current_patch()
-        if not crt:
-            # we don't care, no patches applied
-            return True
-        return git.get_head() == crt.get_top()
-
-    def is_initialised(self):
-        """Checks if series is already initialised
-        """
-        return bool(config.get(format_version_key(self.get_name())))
-
     def init(self, create_at=False, parent_remote=None, parent_branch=None):
         """Initialises the stgit series
         """

^ permalink raw reply related

* [StGIT PATCH 3/4] Move stack format-version checks into Stack class.
From: Yann Dirson @ 2007-06-11  0:33 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git
In-Reply-To: <20070611003117.4736.33551.stgit@gandelf.nowhere.earth>

This defines an interface which is called from PatchSet, and can
(must) be implemented in classes inheriting PatchSet.
---

 stgit/stack.py |  150 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
index 35840e2..89b5a55 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -276,78 +276,6 @@ class Patch(StgitObject):
 # The current StGIT metadata format version.
 FORMAT_VERSION = 2
 
-def format_version_key(branch):
-    return 'branch.%s.stgitformatversion' % branch
-
-def update_to_current_format_version(branch, git_dir):
-    """Update a potentially older StGIT directory structure to the
-    latest version. Note: This function should depend as little as
-    possible on external functions that may change during a format
-    version bump, since it must remain able to process older formats."""
-
-    branch_dir = os.path.join(git_dir, 'patches', branch)
-    def get_format_version():
-        """Return the integer format version number, or None if the
-        branch doesn't have any StGIT metadata at all, of any version."""
-        fv = config.get(format_version_key(branch))
-        if fv:
-            # Great, there's an explicitly recorded format version
-            # number, which means that the branch is initialized and
-            # of that exact version.
-            return int(fv)
-        elif os.path.isdir(os.path.join(branch_dir, 'patches')):
-            # There's a .git/patches/<branch>/patches dirctory, which
-            # means this is an initialized version 1 branch.
-            return 1
-        elif os.path.isdir(branch_dir):
-            # There's a .git/patches/<branch> directory, which means
-            # this is an initialized version 0 branch.
-            return 0
-        else:
-            # The branch doesn't seem to be initialized at all.
-            return None
-    def set_format_version(v):
-        out.info('Upgraded branch %s to format version %d' % (branch, v))
-        config.set(format_version_key(branch), '%d' % v)
-    def mkdir(d):
-        if not os.path.isdir(d):
-            os.makedirs(d)
-    def rm(f):
-        if os.path.exists(f):
-            os.remove(f)
-
-    # Update 0 -> 1.
-    if get_format_version() == 0:
-        mkdir(os.path.join(branch_dir, 'trash'))
-        patch_dir = os.path.join(branch_dir, 'patches')
-        mkdir(patch_dir)
-        refs_dir = os.path.join(git_dir, 'refs', 'patches', branch)
-        mkdir(refs_dir)
-        for patch in (file(os.path.join(branch_dir, 'unapplied')).readlines()
-                      + file(os.path.join(branch_dir, 'applied')).readlines()):
-            patch = patch.strip()
-            os.rename(os.path.join(branch_dir, patch),
-                      os.path.join(patch_dir, patch))
-            Patch(patch, patch_dir, refs_dir).update_top_ref()
-        set_format_version(1)
-
-    # Update 1 -> 2.
-    if get_format_version() == 1:
-        desc_file = os.path.join(branch_dir, 'description')
-        if os.path.isfile(desc_file):
-            desc = read_string(desc_file)
-            if desc:
-                config.set('branch.%s.description' % branch, desc)
-            rm(desc_file)
-        rm(os.path.join(branch_dir, 'current'))
-        rm(os.path.join(git_dir, 'refs', 'bases', branch))
-        set_format_version(2)
-
-    # Make sure we're at the latest version.
-    if not get_format_version() in [None, FORMAT_VERSION]:
-        raise StackException('Branch %s is at format version %d, expected %d'
-                             % (branch, get_format_version(), FORMAT_VERSION))
-
 class PatchSet(StgitObject):
     def get_name(self):
         return self.__name
@@ -400,7 +328,7 @@ class PatchSet(StgitObject):
     def is_initialised(self):
         """Checks if series is already initialised
         """
-        return bool(config.get(format_version_key(self.get_name())))
+        return bool(config.get(self.format_version_key()))
 
 
 class Series(PatchSet):
@@ -422,7 +350,7 @@ class Series(PatchSet):
 
         # Update the branch to the latest format version if it is
         # initialized, but don't touch it if it isn't.
-        update_to_current_format_version(self.get_name(), self.__base_dir)
+        self.update_to_current_format_version()
 
         self.__refs_dir = os.path.join(self.__base_dir, 'refs', 'patches',
                                        self.get_name())
@@ -437,6 +365,78 @@ class Series(PatchSet):
         # trash directory
         self.__trash_dir = os.path.join(self._dir(), 'trash')
 
+    def format_version_key(self):
+        return 'branch.%s.stgitformatversion' % self.get_name()
+
+    def update_to_current_format_version(self):
+        """Update a potentially older StGIT directory structure to the
+        latest version. Note: This function should depend as little as
+        possible on external functions that may change during a format
+        version bump, since it must remain able to process older formats."""
+
+        branch_dir = os.path.join(self.__base_dir, 'patches', self.get_name())
+        def get_format_version():
+            """Return the integer format version number, or None if the
+            branch doesn't have any StGIT metadata at all, of any version."""
+            fv = config.get(self.format_version_key())
+            if fv:
+                # Great, there's an explicitly recorded format version
+                # number, which means that the branch is initialized and
+                # of that exact version.
+                return int(fv)
+            elif os.path.isdir(os.path.join(branch_dir, 'patches')):
+                # There's a .git/patches/<branch>/patches dirctory, which
+                # means this is an initialized version 1 branch.
+                return 1
+            elif os.path.isdir(branch_dir):
+                # There's a .git/patches/<branch> directory, which means
+                # this is an initialized version 0 branch.
+                return 0
+            else:
+                # The branch doesn't seem to be initialized at all.
+                return None
+        def set_format_version(v):
+            out.info('Upgraded branch %s to format version %d' % (self.get_name(), v))
+            config.set(self.format_version_key(), '%d' % v)
+        def mkdir(d):
+            if not os.path.isdir(d):
+                os.makedirs(d)
+        def rm(f):
+            if os.path.exists(f):
+                os.remove(f)
+
+        # Update 0 -> 1.
+        if get_format_version() == 0:
+            mkdir(os.path.join(branch_dir, 'trash'))
+            patch_dir = os.path.join(branch_dir, 'patches')
+            mkdir(patch_dir)
+            refs_dir = os.path.join(self.__base_dir, 'refs', 'patches', self.get_name())
+            mkdir(refs_dir)
+            for patch in (file(os.path.join(branch_dir, 'unapplied')).readlines()
+                          + file(os.path.join(branch_dir, 'applied')).readlines()):
+                patch = patch.strip()
+                os.rename(os.path.join(branch_dir, patch),
+                          os.path.join(patch_dir, patch))
+                Patch(patch, patch_dir, refs_dir).update_top_ref()
+            set_format_version(1)
+
+        # Update 1 -> 2.
+        if get_format_version() == 1:
+            desc_file = os.path.join(branch_dir, 'description')
+            if os.path.isfile(desc_file):
+                desc = read_string(desc_file)
+                if desc:
+                    config.set('branch.%s.description' % self.get_name(), desc)
+                rm(desc_file)
+            rm(os.path.join(branch_dir, 'current'))
+            rm(os.path.join(self.__base_dir, 'refs', 'bases', self.get_name()))
+            set_format_version(2)
+
+        # Make sure we're at the latest version.
+        if not get_format_version() in [None, FORMAT_VERSION]:
+            raise StackException('Branch %s is at format version %d, expected %d'
+                                 % (self.get_name(), get_format_version(), FORMAT_VERSION))
+
     def __patch_name_valid(self, name):
         """Raise an exception if the patch name is not valid.
         """
@@ -584,7 +584,7 @@ class Series(PatchSet):
         os.makedirs(self.__refs_dir)
         self._set_field('orig-base', git.get_head())
 
-        config.set(format_version_key(self.get_name()), str(FORMAT_VERSION))
+        config.set(self.format_version_key(), str(FORMAT_VERSION))
 
     def rename(self, to_name):
         """Renames a series

^ permalink raw reply related

* [StGIT PATCH 4/4] Rename branch.*.stgitformatversion to branch.*.stgit.stackformatversion.
From: Yann Dirson @ 2007-06-11  0:33 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git
In-Reply-To: <20070611003117.4736.33551.stgit@gandelf.nowhere.earth>

Nearly as discussed on the ml, with the name slightly modified to
better allow other types of PatchSet.
---

 stgit/stack.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
index 89b5a55..634588d 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -366,7 +366,7 @@ class Series(PatchSet):
         self.__trash_dir = os.path.join(self._dir(), 'trash')
 
     def format_version_key(self):
-        return 'branch.%s.stgitformatversion' % self.get_name()
+        return 'branch.%s.stgit.stackformatversion' % self.get_name()
 
     def update_to_current_format_version(self):
         """Update a potentially older StGIT directory structure to the
@@ -379,11 +379,17 @@ class Series(PatchSet):
             """Return the integer format version number, or None if the
             branch doesn't have any StGIT metadata at all, of any version."""
             fv = config.get(self.format_version_key())
+            ofv = config.get('branch.%s.stgitformatversion' % self.get_name())
             if fv:
                 # Great, there's an explicitly recorded format version
                 # number, which means that the branch is initialized and
                 # of that exact version.
                 return int(fv)
+            elif ofv:
+                # Old name for the version info, upgrade it
+                config.set(self.format_version_key(), ofv)
+                config.unset('branch.%s.stgitformatversion' % self.get_name())
+                return int(ofv)
             elif os.path.isdir(os.path.join(branch_dir, 'patches')):
                 # There's a .git/patches/<branch>/patches dirctory, which
                 # means this is an initialized version 1 branch.
@@ -713,7 +719,7 @@ class Series(PatchSet):
         config.unset('branch.%s.remote' % self.get_name())
         config.unset('branch.%s.merge' % self.get_name())
         config.unset('branch.%s.stgit.parentbranch' % self.get_name())
-        config.unset('branch.%s.stgitformatversion' % self.get_name())
+        config.unset(self.format_version_key())
 
     def refresh_patch(self, files = None, message = None, edit = False,
                       show_patch = False,

^ permalink raw reply related

* Re: [PATCH 0/6] gitweb: 'commitdiff' view improvements
From: Junio C Hamano @ 2007-06-11  0:36 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <20070608112337.3594.93976.stgit@roke.D-201>

Overall it makes the view of merge commit much more pleasant.
Good job.

[1/6]
Jakub Narebski <jnareb@gmail.com> writes:

> To save space links are shown as "n", where "n" is number of a parent,
> and not as for example shortened (to 7 characters) sha1 of a parent
> commit.  To make it easier to discover what links is for, each link
> has 'title' attribute explaining the link.

Nice; this is a good way to give "diff $it^$n $it".  The 'title'
does not feel that useful but it does not add much to the weight
of the payload so it probably is Ok.

> Example output:
>                           1       2       3 
>   Makefile      patch | diff1 | diff2 | diff3 | blob | history
>   cache.h       patch | diff1 | diff2 | diff3 | blob | history

It is now tempting to change diff[1234...] for each path to
"diff", isn't it?

[3/6]
Jakub Narebski <jnareb@gmail.com> writes:

> This commit makes git_patchset_body easier to read, and reduces level of
> nesting and indent level. It adds more lines that it removes because of
> extra parameter passing in subroutines, and subroutine calls in
> git_patchset_body. Also because there are few added comments.

Very nice.  That gigantic loop in patchset_body has always been
an eyesore.  The main loop is much easier to follow now.

^ permalink raw reply

* Re: [PATCH 2/4] Introduce optional "keywords" on tag objects
From: Junio C Hamano @ 2007-06-11  1:01 UTC (permalink / raw)
  To: Johan Herland; +Cc: Johannes Schindelin, git
In-Reply-To: <200706110116.15673.johan@herland.net>

Johan Herland <johan@herland.net> writes:

> On Sunday 10 June 2007, Junio C Hamano wrote:
>> Johan Herland <johan@herland.net> writes:
>> > For now, I couldn't find a good reason why the set of allowed characters
>> > for keywords should be smaller than for the tag name.
>> 
>> The set of allowed tag names excludes shell metacharacters,
>> primarily to help scripting.  
>
> It already does? Or are you proposing this? Right now the code doesn't 
> enforce anything like this, AFAICS...

Ah, I was being silly.  I somehow thought you were talking about
valid names you can have under refs/tags/.

^ permalink raw reply

* Re: Please pull mergetool.git
From: Junio C Hamano @ 2007-06-11  1:02 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Theodore Ts'o, Git Mailing List
In-Reply-To: <26568045-F443-415E-A250-29C7DD3998A9@silverinsanity.com>

Brian Gernhardt <benji@silverinsanity.com> writes:

> On Jun 10, 2007, at 3:55 PM, Junio C Hamano wrote:
>
>> I do not see problems in the mergetool part, other than that I
>> mildly suspect that opendiff -- actually FileMerge -- might want
>> to be in the test -n "$DISPLAY" section, but that is inherited
>> from the previous iteration so in that sense leaving outside is
>> a sane thing to do.
>
> Actually, opendiff (as FileMerge.app) is available under OS X, where
> $DISPLAY is not set.

Heh, a graphical environment that does not use DISPLAY...

Thanks.

^ permalink raw reply

* Re: [PATCH 1/4] Make tag names (i.e. the tag object's "tag" line) optional
From: Junio C Hamano @ 2007-06-11  1:11 UTC (permalink / raw)
  To: Johan Herland; +Cc: git, Johannes Schindelin
In-Reply-To: <200706110101.08664.johan@herland.net>

Johan Herland <johan@herland.net> writes:

> If the "tag" line remains mandatory, I'll have to construct an
> artificial name for unnamed 'notes'...

Ah, silly me, now I remember.

But let's put this series on hold and see how versioned set of
notes from Johannes turns out.  It seems that people are in
favor of its simplicity, and even though it may be much less
expressive, it might be sufficient for certain class of
applications.  It one certainly is a much smaller and isolated
change that we could easily drop more easily if it does not work
out.

^ permalink raw reply

* Re: [PATCH] Introduce light weight commit annotations
From: Junio C Hamano @ 2007-06-11  1:11 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Johannes Schindelin, git, Johan Herland
In-Reply-To: <20070610232016.GB5761@steel.home>

Alex Riesen <raa.lkml@gmail.com> writes:

> BTW, the annotations are a bit cumbersome to merge, if this
> implementation is to stay (and I personally would like it to) we may
> have to mention this little inconvenience somewhere.
>
> And can I suggest an interface like the below?
>
>     git notes [[--show] <commit>+] [-d|--delete <commit>+] [-e|--edit <commit>]
>
> With the annotations file being completely removed if it is empty.

That is a saner and more extensible interface.

I'll commit a minimally fixed version (essentially, renaming
"annotations" to "notes") of Johannes's and push it out to 'pu'
tonight.

I think it is a mistake to use config in Johannes's patch,
especially without giving a command line override to disable
the call to show_annotations() in a repository that has
config.showannotations variable set, because the script primes
the input with something like this:

	git log -1 $COMMIT | sed -e 's/^/#/' >$MESSAGE
	git cat-file blob $existing_note >>$MESSAGE

and the first "git log" would have already given you the
contents of the existing note ;-).

^ permalink raw reply

* Re: [PATCH] Add --no-reuse-delta option to git-gc
From: Nicolas Pitre @ 2007-06-11  1:51 UTC (permalink / raw)
  To: Sam Vilain
  Cc: Steven Grimm, Shawn O. Pearce, Junio C Hamano, Daniel Barkalow,
	Theodore Ts'o, Git Mailing List
In-Reply-To: <466BAAD0.9060408@vilain.net>

On Sun, 10 Jun 2007, Sam Vilain wrote:

> Now I'm not an expert on compression algorithms but I think a large part
> of the reason gzip is blindingly faster than bzip2 is because gzip uses
> a 64k buffer and bzip2 a 900k one. Only now are CPUs getting caches
> large enough to deal with that size of buffer, the rest of the time
> you're waiting for your RAM. Moore's law was supposed to make bzip2 fast
> one of these days but I'm still waiting.
> 
> Anyway it's a free world so be my guest to implement it, I guess if this
> was selectable it would only be a minor annoyance waiting a bit longer
> pulling from from some repositories, and it would be interesting to see
> if it did make a big difference with pack file sizes.

It won't happen for a simple reason: to be backward compatible with 
older GIT clients.  If you have your repo compressed with bzip2 and an 
old client pulls it then the server would have to decompress and 
recompress everything with gzip.  If instead your repo remains with gzip 
and a new client asks for bzip2 then you have to recompress as well 
(slow).  So in practice it is best to remain with a single compression 
method.


Nicolas

^ permalink raw reply

* Re: Please pull mergetool.git
From: Martin Langhoff @ 2007-06-11  1:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brian Gernhardt, Theodore Ts'o, Git Mailing List
In-Reply-To: <7vabv74838.fsf@assigned-by-dhcp.cox.net>

On 6/11/07, Junio C Hamano <gitster@pobox.com> wrote:
> Brian Gernhardt <benji@silverinsanity.com> writes:
> > Actually, opendiff (as FileMerge.app) is available under OS X, where
> > $DISPLAY is not set.
>
> Heh, a graphical environment that does not use DISPLAY...

FWIW, it depends on whether you are using xterm (DISPLAY is set) or
Terminal.app (DISPLAY may not be set). In any case FileMerge.app will
ignore DISPLAY.

cheers,


m

^ permalink raw reply

* Re: [PATCH] Introduce light weight commit annotations
From: Nicolas Pitre @ 2007-06-11  2:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, gitster, Johan Herland
In-Reply-To: <Pine.LNX.4.64.0706091854330.4059@racer.site>

On Sat, 9 Jun 2007, Johannes Schindelin wrote:

> The annotations are tracked in a new ref, refs/annotations/commits,
> in the same fan-out style as .git/objects/??/*, only that they only
> exist in the object database now.

Isn't this abusing the refs namespace a bit?  Why not 
.git/annotations/... instead?


Nicolas

^ permalink raw reply

* Re: git-svn set-tree bug
From: Eric Wong @ 2007-06-11  4:25 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: Steven Grimm, git
In-Reply-To: <003401c7abba$c7574300$0e67a8c0@Jocke>

Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> > -----Original Message-----
> > From: Steven Grimm [mailto:koreth@midwinter.com] 
> > Sent: den 11 juni 2007 01:37
> > To: Joakim Tjernlund
> > Cc: 'Eric Wong'; 'git'
> > Subject: Re: git-svn set-tree bug
> > 
> > Joakim Tjernlund wrote:
> > > Is there a way to tell set-tree to commit the whole "merge" branch
> > > as one svn commit?
> > > If I merge the latest kernel into my tree there will
> > > be a lot of commits that I don't want in svn.
> > >   
> > 
> > You want a "squash" merge. Something like this:
> > 
> > git checkout -b tempbranch origin/svn-branch-to-commit-merge-to
> > git merge --squash branch-with-commits-you-want-to-merge
> > git commit
> > git svn dcommit
> > 
> > The "merge" command will merge in the changes but will not commit 
> > anything; when you do the explicit "commit" command 
> > afterwards, you get 
> > the contents of the merge but from git's point of view it's just a 
> > regular commit so git-svn doesn't get confused.
> > 
> > After you do git svn dcommit, you may want to edit 
> > .git/info/grafts to 
> > tell git after the fact that this commit was a merge. It won't hurt 
> > git-svn at that point and it will mean you can do another merge later 
> > without git getting confused about what has already been merged.
> > 
> > Take a look at the script I posted a while back, which does something 
> > similar:
> > 
> > http://www.spinics.net/lists/git/msg29119.html

I must have missed this message the first time around.

> Hi Steven
> 
> That looks promising, especially Junos comment about making git-svn
> able to deal with merges. Eric, do you feel this is doable?

Doable?  Yes.  However, I think using grafts is quite hackish and
unreliable[1].  I'd rather just have users using set-tree if
they want to deal with non-linear history in the first place.

I'd personally avoid any sort of non-linear history when interacting
with SVN repositories, however.

[1] - as far as I know, graft files have no verification/protection
      against corruption.  They don't get cloned, either.

-- 
Eric Wong

^ permalink raw reply

* Re: git-svn - creating a tag in a cloned SVN repository
From: Eric Wong @ 2007-06-11  4:26 UTC (permalink / raw)
  To: Adam Piatyszek; +Cc: git
In-Reply-To: <466C624F.70303@users.sourceforge.net>

Adam Piatyszek <ediap@users.sourceforge.net> wrote:
> Hi!
> 
> I recently switched to git for my projects, even for these which are
> tracked in remote SVN repositories (thanks to git-svn tool).
> However, I did not find anywhere an answer to one question:
> 
> Is it possible to create a subversion-like tag in the remote SVN
> repository using git-svn?
> 
> In more detail: is it possible to emulate the following SVN command:
>   svn copy http://svn.project.server/project/trunk \
>            http://svn.project.server/project/tags/release-1.0
> using git-svn?

No, not at the moment.  Patches welcome :)

-- 
Eric Wong

^ permalink raw reply

* Re: [Qgit RFC] commit --amend
From: Jan Hudec @ 2007-06-11  4:42 UTC (permalink / raw)
  To: Marco Costalba; +Cc: git
In-Reply-To: <e5bfff550706101510x6d685944ja70c9d9dbb3668f6@mail.gmail.com>

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

On Mon, Jun 11, 2007 at 00:10:20 +0200, Marco Costalba wrote:
> On 6/10/07, Jan Hudec <bulb@ucw.cz> wrote:
> >Hello,
> >
> >I am thinking about adding commit --amend support to Qgit.
> >
> 
> Good!
> 
> > - Add a separate action to the menu. This action would take over the 
> > refresh
> >   (Add to top) operation when using stgit.
> >
> >   I believe this has lower risk of user errors than the previous option. 
> >   It
> >   also has the advantage, that I don't have to touch the disabling logic 
> >   for
> >   the commit action. Amending last commit is always possible, even if 
> >   there
> >   are no changes, because you might want to edit the message (eg. if you
> >   forget to sign-off or forget to mention some change or something).
> >
> 
> Yes. But amending is an option of commit (also in git) so probably the
> amend action will fire the commit dialog anyway and we are back to
> previous situation. The only advantage is that we can load the message
> of the tip revision as default instead of git-status output as the
> current.
> 
> 
> >I'll try doing the first option now, unless somebody persuades me that it's
> >a nonsense.
> >
> 
> I think it's the best: 'Sync' button is very seldom used (I think I've
> never used it but for testing that it works) and updating the index is
> something very plumbing anyway.
> 
> What we could add is another button 'Load prev msg' to do what it
> says, so we would end up with 5 buttons:
> 
> - Settings /Cancel/ Load prev msg / Amend /Commit
> 
> I don't see a reason to set 'Load prev msg' as a check button, you may
> want to reload the prev msg as many times as you need, (re)clicking
> everytime on the button, also for a normal commit where as example you
> want to keep the header or part of the subject of the previous
> revision.

I think it would be somewhat complicated unfortunately :-(. The loading of
previous message should be really tied to whether you are about to
amend/refresh or to commit/add new. In this respect this would actually match
the command-line interface, because you say whether you want to amend
*before* you edit the message.

So I am now inclined more to the separate action and trying to go that way.
But the difference between the variants would not be that big.

> Please let me know if and where you find something obscure/messy with
> the code, I will be happy to help you.

I think I mostly understood it now. Thank you.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* git commit --amend -F ?
From: Jan Hudec @ 2007-06-11  5:05 UTC (permalink / raw)
  To: git

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

Hello,

Why isn't git commit --amend -F allowed?

Yes, I know guis (qgit) should be using plumbing commands, but still...

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ 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