{"thread":{"id":"8552","subject":"[StGIT PATCH 1/4] Use get/set_name for a stack's name.","startedAt":"2007-06-11T00:33:20Z","lastAt":"2007-06-19T22:37:00Z","messageCount":14,"participants":["Yann Dirson","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"44676","messageId":"20070611003117.4736.33551.stgit@gandelf.nowhere.earth","threadId":"8552","inReplyTo":null,"subject":"[StGIT PATCH 0/4] Cleanups of the Series object.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-11T00:33:20Z","receivedAt":"2007-06-11T00:33:20Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"These cleanups and under-the-hood evolutions are mostly driven by my\n(still preliminar) work at allowing to work on several stacks at a\ntime using hydras.\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"44674","messageId":"20070611003325.4736.58433.stgit@gandelf.nowhere.earth","threadId":"8552","inReplyTo":"20070611003117.4736.33551.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 1/4] Use get/set_name for a stack's name.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-11T00:33:25Z","receivedAt":"2007-06-11T00:33:25Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"It is much more clear to use get_name() than get_branch(), and this is\na step towards factoring stuff into a PatchSet class.\n---\n\n stgit/commands/branch.py |   12 +++---\n stgit/commands/export.py |    2 +\n stgit/commands/pull.py   |    2 +\n stgit/commands/series.py |    2 +\n stgit/commands/sync.py   |    2 +\n stgit/stack.py           |   88 +++++++++++++++++++++++-----------------------\n 6 files changed, 54 insertions(+), 54 deletions(-)\n\ndiff --git a/stgit/commands/branch.py b/stgit/commands/branch.py\nindex 07bdca8..c22e143 100644\n--- a/stgit/commands/branch.py\n+++ b/stgit/commands/branch.py\n@@ -68,7 +68,7 @@ options = [make_option('-c', '--create',\n \n \n def __is_current_branch(branch_name):\n-    return crt_series.get_branch() == branch_name\n+    return crt_series.get_name() == branch_name\n \n def __print_branch(branch_name, length):\n     initialized = ' '\n@@ -168,7 +168,7 @@ def func(parser, options, args):\n     elif options.clone:\n \n         if len(args) == 0:\n-            clone = crt_series.get_branch() + \\\n+            clone = crt_series.get_name() + \\\n                     time.strftime('-%C%y%m%d-%H%M%S')\n         elif len(args) == 1:\n             clone = args[0]\n@@ -215,7 +215,7 @@ def func(parser, options, args):\n     elif options.protect:\n \n         if len(args) == 0:\n-            branch_name = crt_series.get_branch()\n+            branch_name = crt_series.get_name()\n         elif len(args) == 1:\n             branch_name = args[0]\n         else:\n@@ -249,7 +249,7 @@ def func(parser, options, args):\n     elif options.unprotect:\n \n         if len(args) == 0:\n-            branch_name = crt_series.get_branch()\n+            branch_name = crt_series.get_name()\n         elif len(args) == 1:\n             branch_name = args[0]\n         else:\n@@ -269,7 +269,7 @@ def func(parser, options, args):\n     elif options.description is not None:\n \n         if len(args) == 0:\n-            branch_name = crt_series.get_branch()\n+            branch_name = crt_series.get_name()\n         elif len(args) == 1:\n             branch_name = args[0]\n         else:\n@@ -303,4 +303,4 @@ def func(parser, options, args):\n     if len(args) != 0:\n         parser.error('incorrect number of arguments')\n \n-    print crt_series.get_branch()\n+    print crt_series.get_name()\ndiff --git a/stgit/commands/export.py b/stgit/commands/export.py\nindex 35851bc..8424f9d 100644\n--- a/stgit/commands/export.py\n+++ b/stgit/commands/export.py\n@@ -75,7 +75,7 @@ def func(parser, options, args):\n     if options.dir:\n         dirname = options.dir\n     else:\n-        dirname = 'patches-%s' % crt_series.get_branch()\n+        dirname = 'patches-%s' % crt_series.get_name()\n \n     if not options.branch and git.local_changes():\n         out.warn('Local changes in the tree;'\ndiff --git a/stgit/commands/pull.py b/stgit/commands/pull.py\nindex beaa7b5..5f72f9b 100644\n--- a/stgit/commands/pull.py\n+++ b/stgit/commands/pull.py\n@@ -50,7 +50,7 @@ options = [make_option('-n', '--nopush',\n def func(parser, options, args):\n     \"\"\"Pull the changes from a remote repository\n     \"\"\"\n-    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \\\n+    policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_name()) or \\\n              config.get('stgit.pull-policy')\n \n     if policy == 'rebase':\ndiff --git a/stgit/commands/series.py b/stgit/commands/series.py\nindex fe4e468..0b3efe0 100644\n--- a/stgit/commands/series.py\n+++ b/stgit/commands/series.py\n@@ -181,7 +181,7 @@ def func(parser, options, args):\n         return\n \n     if options.showbranch:\n-        branch_str = '@' + crt_series.get_branch()\n+        branch_str = '@' + crt_series.get_name()\n     else:\n         branch_str = ''\n \ndiff --git a/stgit/commands/sync.py b/stgit/commands/sync.py\nindex 8359061..e769602 100644\n--- a/stgit/commands/sync.py\n+++ b/stgit/commands/sync.py\n@@ -85,7 +85,7 @@ def func(parser, options, args):\n         # branch\n         remote_series = crt_series\n         stgit.commands.common.crt_series = crt_series = stack.Series()\n-        if options.branch == crt_series.get_branch():\n+        if options.branch == crt_series.get_name():\n             raise CmdException, 'Cannot synchronise with the current branch'\n         remote_patches = remote_series.get_applied()\n \ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex a64aff6..0d475da 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -356,21 +356,21 @@ class Series(StgitObject):\n         \"\"\"\n         try:\n             if name:\n-                self.__name = name\n+                self.set_name (name)\n             else:\n-                self.__name = git.get_head_file()\n+                self.set_name (git.get_head_file())\n             self.__base_dir = basedir.get()\n         except git.GitException, ex:\n             raise StackException, 'GIT tree not initialised: %s' % ex\n \n-        self._set_dir(os.path.join(self.__base_dir, 'patches', self.__name))\n+        self._set_dir(os.path.join(self.__base_dir, 'patches', self.get_name()))\n \n         # Update the branch to the latest format version if it is\n         # initialized, but don't touch it if it isn't.\n-        update_to_current_format_version(self.__name, self.__base_dir)\n+        update_to_current_format_version(self.get_name(), self.__base_dir)\n \n         self.__refs_dir = os.path.join(self.__base_dir, 'refs', 'patches',\n-                                       self.__name)\n+                                       self.get_name())\n \n         self.__applied_file = os.path.join(self._dir(), 'applied')\n         self.__unapplied_file = os.path.join(self._dir(), 'unapplied')\n@@ -388,11 +388,11 @@ class Series(StgitObject):\n         if not name or re.search('[^\\w.-]', name):\n             raise StackException, 'Invalid patch name: \"%s\"' % name\n \n-    def get_branch(self):\n-        \"\"\"Return the branch name for the Series object\n-        \"\"\"\n+    def get_name(self):\n         return self.__name\n-\n+    def set_name(self, name):\n+        self.__name = name\n+        \n     def get_patch(self, name):\n         \"\"\"Return a Patch object for the given name\n         \"\"\"\n@@ -422,12 +422,12 @@ class Series(StgitObject):\n \n     def get_applied(self):\n         if not os.path.isfile(self.__applied_file):\n-            raise StackException, 'Branch \"%s\" not initialised' % self.__name\n+            raise StackException, 'Branch \"%s\" not initialised' % self.get_name()\n         return read_strings(self.__applied_file)\n \n     def get_unapplied(self):\n         if not os.path.isfile(self.__unapplied_file):\n-            raise StackException, 'Branch \"%s\" not initialised' % self.__name\n+            raise StackException, 'Branch \"%s\" not initialised' % self.get_name()\n         return read_strings(self.__unapplied_file)\n \n     def get_hidden(self):\n@@ -467,7 +467,7 @@ class Series(StgitObject):\n             os.remove(protect_file)\n \n     def __branch_descr(self):\n-        return 'branch.%s.description' % self.get_branch()\n+        return 'branch.%s.description' % self.get_name()\n \n     def get_description(self):\n         return config.get(self.__branch_descr()) or ''\n@@ -479,41 +479,41 @@ class Series(StgitObject):\n             config.unset(self.__branch_descr())\n \n     def get_parent_remote(self):\n-        value = config.get('branch.%s.remote' % self.__name)\n+        value = config.get('branch.%s.remote' % self.get_name())\n         if value:\n             return value\n         elif 'origin' in git.remotes_list():\n             out.note(('No parent remote declared for stack \"%s\",'\n-                      ' defaulting to \"origin\".' % self.__name),\n+                      ' defaulting to \"origin\".' % self.get_name()),\n                      ('Consider setting \"branch.%s.remote\" and'\n                       ' \"branch.%s.merge\" with \"git repo-config\".'\n-                      % (self.__name, self.__name)))\n+                      % (self.get_name(), self.get_name())))\n             return 'origin'\n         else:\n-            raise StackException, 'Cannot find a parent remote for \"%s\"' % self.__name\n+            raise StackException, 'Cannot find a parent remote for \"%s\"' % self.get_name()\n \n     def __set_parent_remote(self, remote):\n-        value = config.set('branch.%s.remote' % self.__name, remote)\n+        value = config.set('branch.%s.remote' % self.get_name(), remote)\n \n     def get_parent_branch(self):\n-        value = config.get('branch.%s.stgit.parentbranch' % self.__name)\n+        value = config.get('branch.%s.stgit.parentbranch' % self.get_name())\n         if value:\n             return value\n         elif git.rev_parse('heads/origin'):\n             out.note(('No parent branch declared for stack \"%s\",'\n-                      ' defaulting to \"heads/origin\".' % self.__name),\n+                      ' defaulting to \"heads/origin\".' % self.get_name()),\n                      ('Consider setting \"branch.%s.stgit.parentbranch\"'\n-                      ' with \"git repo-config\".' % self.__name))\n+                      ' with \"git repo-config\".' % self.get_name()))\n             return 'heads/origin'\n         else:\n-            raise StackException, 'Cannot find a parent branch for \"%s\"' % self.__name\n+            raise StackException, 'Cannot find a parent branch for \"%s\"' % self.get_name()\n \n     def __set_parent_branch(self, name):\n-        if config.get('branch.%s.remote' % self.__name):\n+        if config.get('branch.%s.remote' % self.get_name()):\n             # Never set merge if remote is not set to avoid\n             # possibly-erroneous lookups into 'origin'\n-            config.set('branch.%s.merge' % self.__name, name)\n-        config.set('branch.%s.stgit.parentbranch' % self.__name, name)\n+            config.set('branch.%s.merge' % self.get_name(), name)\n+        config.set('branch.%s.stgit.parentbranch' % self.get_name(), name)\n \n     def set_parent(self, remote, localbranch):\n         if localbranch:\n@@ -521,7 +521,7 @@ class Series(StgitObject):\n             self.__set_parent_branch(localbranch)\n         # We'll enforce this later\n #         else:\n-#             raise StackException, 'Parent branch (%s) should be specified for %s' % localbranch, self.__name\n+#             raise StackException, 'Parent branch (%s) should be specified for %s' % localbranch, self.get_name()\n \n     def __patch_is_current(self, patch):\n         return patch.get_name() == self.get_current()\n@@ -559,19 +559,19 @@ class Series(StgitObject):\n     def is_initialised(self):\n         \"\"\"Checks if series is already initialised\n         \"\"\"\n-        return bool(config.get(format_version_key(self.get_branch())))\n+        return bool(config.get(format_version_key(self.get_name())))\n \n     def init(self, create_at=False, parent_remote=None, parent_branch=None):\n         \"\"\"Initialises the stgit series\n         \"\"\"\n         if self.is_initialised():\n-            raise StackException, '%s already initialized' % self.get_branch()\n+            raise StackException, '%s already initialized' % self.get_name()\n         for d in [self._dir(), self.__refs_dir]:\n             if os.path.exists(d):\n                 raise StackException, '%s already exists' % d\n \n         if (create_at!=False):\n-            git.create_branch(self.__name, create_at)\n+            git.create_branch(self.get_name(), create_at)\n \n         os.makedirs(self.__patch_dir)\n \n@@ -582,7 +582,7 @@ class Series(StgitObject):\n         os.makedirs(self.__refs_dir)\n         self._set_field('orig-base', git.get_head())\n \n-        config.set(format_version_key(self.get_branch()), str(FORMAT_VERSION))\n+        config.set(format_version_key(self.get_name()), str(FORMAT_VERSION))\n \n     def rename(self, to_name):\n         \"\"\"Renames a series\n@@ -590,19 +590,19 @@ class Series(StgitObject):\n         to_stack = Series(to_name)\n \n         if to_stack.is_initialised():\n-            raise StackException, '\"%s\" already exists' % to_stack.get_branch()\n+            raise StackException, '\"%s\" already exists' % to_stack.get_name()\n \n-        git.rename_branch(self.__name, to_name)\n+        git.rename_branch(self.get_name(), to_name)\n \n         if os.path.isdir(self._dir()):\n             rename(os.path.join(self.__base_dir, 'patches'),\n-                   self.__name, to_stack.__name)\n+                   self.get_name(), to_stack.get_name())\n         if os.path.exists(self.__refs_dir):\n             rename(os.path.join(self.__base_dir, 'refs', 'patches'),\n-                   self.__name, to_stack.__name)\n+                   self.get_name(), to_stack.get_name())\n \n         # Rename the config section\n-        config.rename_section(\"branch.%s\" % self.__name,\n+        config.rename_section(\"branch.%s\" % self.get_name(),\n                               \"branch.%s\" % to_name)\n \n         self.__init__(to_name)\n@@ -619,7 +619,7 @@ class Series(StgitObject):\n         new_series = Series(target_series)\n \n         # generate an artificial description file\n-        new_series.set_description('clone of \"%s\"' % self.__name)\n+        new_series.set_description('clone of \"%s\"' % self.get_name())\n \n         # clone self's entire series as unapplied patches\n         try:\n@@ -649,15 +649,15 @@ class Series(StgitObject):\n         new_series.forward_patches(applied)\n \n         # Clone parent informations\n-        value = config.get('branch.%s.remote' % self.__name)\n+        value = config.get('branch.%s.remote' % self.get_name())\n         if value:\n             config.set('branch.%s.remote' % target_series, value)\n \n-        value = config.get('branch.%s.merge' % self.__name)\n+        value = config.get('branch.%s.merge' % self.get_name())\n         if value:\n             config.set('branch.%s.merge' % target_series, value)\n \n-        value = config.get('branch.%s.stgit.parentbranch' % self.__name)\n+        value = config.get('branch.%s.stgit.parentbranch' % self.get_name())\n         if value:\n             config.set('branch.%s.stgit.parentbranch' % target_series, value)\n \n@@ -708,10 +708,10 @@ class Series(StgitObject):\n         # Cleanup parent informations\n         # FIXME: should one day make use of git-config --section-remove,\n         # scheduled for 1.5.1\n-        config.unset('branch.%s.remote' % self.__name)\n-        config.unset('branch.%s.merge' % self.__name)\n-        config.unset('branch.%s.stgit.parentbranch' % self.__name)\n-        config.unset('branch.%s.stgitformatversion' % self.__name)\n+        config.unset('branch.%s.remote' % self.get_name())\n+        config.unset('branch.%s.merge' % self.get_name())\n+        config.unset('branch.%s.stgit.parentbranch' % self.get_name())\n+        config.unset('branch.%s.stgitformatversion' % self.get_name())\n \n     def refresh_patch(self, files = None, message = None, edit = False,\n                       show_patch = False,\n@@ -1093,13 +1093,13 @@ class Series(StgitObject):\n \n         patch = Patch(name, self.__patch_dir, self.__refs_dir)\n \n-        if git.get_head_file() == self.get_branch():\n+        if git.get_head_file() == self.get_name():\n             if keep and not git.apply_diff(git.get_head(), patch.get_bottom()):\n                 raise StackException(\n                     'Failed to pop patches while preserving the local changes')\n             git.switch(patch.get_bottom(), keep)\n         else:\n-            git.set_branch(self.get_branch(), patch.get_bottom())\n+            git.set_branch(self.get_name(), patch.get_bottom())\n \n         # save the new applied list\n         idx = applied.index(name) + 1\n"},{"id":"44675","messageId":"20070611003330.4736.69293.stgit@gandelf.nowhere.earth","threadId":"8552","inReplyTo":"20070611003117.4736.33551.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-11T00:33:30Z","receivedAt":"2007-06-11T00:33:30Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The goal is to move into PatchSet all functionnality that is not\ndependant of Series being a real stack, paving the way for handling\nparallel (hydra) stacks, or any other way to organize patches.\n---\n\n stgit/stack.py |  110 +++++++++++++++++++++++++++++---------------------------\n 1 files changed, 56 insertions(+), 54 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 0d475da..35840e2 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -348,7 +348,62 @@ def update_to_current_format_version(branch, git_dir):\n         raise StackException('Branch %s is at format version %d, expected %d'\n                              % (branch, get_format_version(), FORMAT_VERSION))\n \n-class Series(StgitObject):\n+class PatchSet(StgitObject):\n+    def get_name(self):\n+        return self.__name\n+    def set_name(self, name):\n+        self.__name = name\n+\n+    def get_head(self):\n+        \"\"\"Return the head of the branch\n+        \"\"\"\n+        crt = self.get_current_patch()\n+        if crt:\n+            return crt.get_top()\n+        else:\n+            return self.get_base()\n+\n+    def get_protected(self):\n+        return os.path.isfile(os.path.join(self._dir(), 'protected'))\n+\n+    def protect(self):\n+        protect_file = os.path.join(self._dir(), 'protected')\n+        if not os.path.isfile(protect_file):\n+            create_empty_file(protect_file)\n+\n+    def unprotect(self):\n+        protect_file = os.path.join(self._dir(), 'protected')\n+        if os.path.isfile(protect_file):\n+            os.remove(protect_file)\n+\n+    def __branch_descr(self):\n+        return 'branch.%s.description' % self.get_name()\n+\n+    def get_description(self):\n+        return config.get(self.__branch_descr()) or ''\n+\n+    def set_description(self, line):\n+        if line:\n+            config.set(self.__branch_descr(), line)\n+        else:\n+            config.unset(self.__branch_descr())\n+\n+    def head_top_equal(self):\n+        \"\"\"Return true if the head and the top are the same\n+        \"\"\"\n+        crt = self.get_current_patch()\n+        if not crt:\n+            # we don't care, no patches applied\n+            return True\n+        return git.get_head() == crt.get_top()\n+\n+    def is_initialised(self):\n+        \"\"\"Checks if series is already initialised\n+        \"\"\"\n+        return bool(config.get(format_version_key(self.get_name())))\n+\n+\n+class Series(PatchSet):\n     \"\"\"Class including the operations on series\n     \"\"\"\n     def __init__(self, name = None):\n@@ -388,11 +443,6 @@ class Series(StgitObject):\n         if not name or re.search('[^\\w.-]', name):\n             raise StackException, 'Invalid patch name: \"%s\"' % name\n \n-    def get_name(self):\n-        return self.__name\n-    def set_name(self, name):\n-        self.__name = name\n-        \n     def get_patch(self, name):\n         \"\"\"Return a Patch object for the given name\n         \"\"\"\n@@ -444,40 +494,6 @@ class Series(StgitObject):\n         # No bottommost patch, so just return HEAD\n         return git.get_head()\n \n-    def get_head(self):\n-        \"\"\"Return the head of the branch\n-        \"\"\"\n-        crt = self.get_current_patch()\n-        if crt:\n-            return crt.get_top()\n-        else:\n-            return self.get_base()\n-\n-    def get_protected(self):\n-        return os.path.isfile(os.path.join(self._dir(), 'protected'))\n-\n-    def protect(self):\n-        protect_file = os.path.join(self._dir(), 'protected')\n-        if not os.path.isfile(protect_file):\n-            create_empty_file(protect_file)\n-\n-    def unprotect(self):\n-        protect_file = os.path.join(self._dir(), 'protected')\n-        if os.path.isfile(protect_file):\n-            os.remove(protect_file)\n-\n-    def __branch_descr(self):\n-        return 'branch.%s.description' % self.get_name()\n-\n-    def get_description(self):\n-        return config.get(self.__branch_descr()) or ''\n-\n-    def set_description(self, line):\n-        if line:\n-            config.set(self.__branch_descr(), line)\n-        else:\n-            config.unset(self.__branch_descr())\n-\n     def get_parent_remote(self):\n         value = config.get('branch.%s.remote' % self.get_name())\n         if value:\n@@ -547,20 +563,6 @@ class Series(StgitObject):\n         return self.patch_applied(name) or self.patch_unapplied(name) \\\n                or self.patch_hidden(name)\n \n-    def head_top_equal(self):\n-        \"\"\"Return true if the head and the top are the same\n-        \"\"\"\n-        crt = self.get_current_patch()\n-        if not crt:\n-            # we don't care, no patches applied\n-            return True\n-        return git.get_head() == crt.get_top()\n-\n-    def is_initialised(self):\n-        \"\"\"Checks if series is already initialised\n-        \"\"\"\n-        return bool(config.get(format_version_key(self.get_name())))\n-\n     def init(self, create_at=False, parent_remote=None, parent_branch=None):\n         \"\"\"Initialises the stgit series\n         \"\"\"\n"},{"id":"44678","messageId":"20070611003336.4736.95971.stgit@gandelf.nowhere.earth","threadId":"8552","inReplyTo":"20070611003117.4736.33551.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 3/4] Move stack format-version checks into Stack class.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-11T00:33:36Z","receivedAt":"2007-06-11T00:33:36Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This defines an interface which is called from PatchSet, and can\n(must) be implemented in classes inheriting PatchSet.\n---\n\n stgit/stack.py |  150 ++++++++++++++++++++++++++++----------------------------\n 1 files changed, 75 insertions(+), 75 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 35840e2..89b5a55 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -276,78 +276,6 @@ class Patch(StgitObject):\n # The current StGIT metadata format version.\n FORMAT_VERSION = 2\n \n-def format_version_key(branch):\n-    return 'branch.%s.stgitformatversion' % branch\n-\n-def update_to_current_format_version(branch, git_dir):\n-    \"\"\"Update a potentially older StGIT directory structure to the\n-    latest version. Note: This function should depend as little as\n-    possible on external functions that may change during a format\n-    version bump, since it must remain able to process older formats.\"\"\"\n-\n-    branch_dir = os.path.join(git_dir, 'patches', branch)\n-    def get_format_version():\n-        \"\"\"Return the integer format version number, or None if the\n-        branch doesn't have any StGIT metadata at all, of any version.\"\"\"\n-        fv = config.get(format_version_key(branch))\n-        if fv:\n-            # Great, there's an explicitly recorded format version\n-            # number, which means that the branch is initialized and\n-            # of that exact version.\n-            return int(fv)\n-        elif os.path.isdir(os.path.join(branch_dir, 'patches')):\n-            # There's a .git/patches/<branch>/patches dirctory, which\n-            # means this is an initialized version 1 branch.\n-            return 1\n-        elif os.path.isdir(branch_dir):\n-            # There's a .git/patches/<branch> directory, which means\n-            # this is an initialized version 0 branch.\n-            return 0\n-        else:\n-            # The branch doesn't seem to be initialized at all.\n-            return None\n-    def set_format_version(v):\n-        out.info('Upgraded branch %s to format version %d' % (branch, v))\n-        config.set(format_version_key(branch), '%d' % v)\n-    def mkdir(d):\n-        if not os.path.isdir(d):\n-            os.makedirs(d)\n-    def rm(f):\n-        if os.path.exists(f):\n-            os.remove(f)\n-\n-    # Update 0 -> 1.\n-    if get_format_version() == 0:\n-        mkdir(os.path.join(branch_dir, 'trash'))\n-        patch_dir = os.path.join(branch_dir, 'patches')\n-        mkdir(patch_dir)\n-        refs_dir = os.path.join(git_dir, 'refs', 'patches', branch)\n-        mkdir(refs_dir)\n-        for patch in (file(os.path.join(branch_dir, 'unapplied')).readlines()\n-                      + file(os.path.join(branch_dir, 'applied')).readlines()):\n-            patch = patch.strip()\n-            os.rename(os.path.join(branch_dir, patch),\n-                      os.path.join(patch_dir, patch))\n-            Patch(patch, patch_dir, refs_dir).update_top_ref()\n-        set_format_version(1)\n-\n-    # Update 1 -> 2.\n-    if get_format_version() == 1:\n-        desc_file = os.path.join(branch_dir, 'description')\n-        if os.path.isfile(desc_file):\n-            desc = read_string(desc_file)\n-            if desc:\n-                config.set('branch.%s.description' % branch, desc)\n-            rm(desc_file)\n-        rm(os.path.join(branch_dir, 'current'))\n-        rm(os.path.join(git_dir, 'refs', 'bases', branch))\n-        set_format_version(2)\n-\n-    # Make sure we're at the latest version.\n-    if not get_format_version() in [None, FORMAT_VERSION]:\n-        raise StackException('Branch %s is at format version %d, expected %d'\n-                             % (branch, get_format_version(), FORMAT_VERSION))\n-\n class PatchSet(StgitObject):\n     def get_name(self):\n         return self.__name\n@@ -400,7 +328,7 @@ class PatchSet(StgitObject):\n     def is_initialised(self):\n         \"\"\"Checks if series is already initialised\n         \"\"\"\n-        return bool(config.get(format_version_key(self.get_name())))\n+        return bool(config.get(self.format_version_key()))\n \n \n class Series(PatchSet):\n@@ -422,7 +350,7 @@ class Series(PatchSet):\n \n         # Update the branch to the latest format version if it is\n         # initialized, but don't touch it if it isn't.\n-        update_to_current_format_version(self.get_name(), self.__base_dir)\n+        self.update_to_current_format_version()\n \n         self.__refs_dir = os.path.join(self.__base_dir, 'refs', 'patches',\n                                        self.get_name())\n@@ -437,6 +365,78 @@ class Series(PatchSet):\n         # trash directory\n         self.__trash_dir = os.path.join(self._dir(), 'trash')\n \n+    def format_version_key(self):\n+        return 'branch.%s.stgitformatversion' % self.get_name()\n+\n+    def update_to_current_format_version(self):\n+        \"\"\"Update a potentially older StGIT directory structure to the\n+        latest version. Note: This function should depend as little as\n+        possible on external functions that may change during a format\n+        version bump, since it must remain able to process older formats.\"\"\"\n+\n+        branch_dir = os.path.join(self.__base_dir, 'patches', self.get_name())\n+        def get_format_version():\n+            \"\"\"Return the integer format version number, or None if the\n+            branch doesn't have any StGIT metadata at all, of any version.\"\"\"\n+            fv = config.get(self.format_version_key())\n+            if fv:\n+                # Great, there's an explicitly recorded format version\n+                # number, which means that the branch is initialized and\n+                # of that exact version.\n+                return int(fv)\n+            elif os.path.isdir(os.path.join(branch_dir, 'patches')):\n+                # There's a .git/patches/<branch>/patches dirctory, which\n+                # means this is an initialized version 1 branch.\n+                return 1\n+            elif os.path.isdir(branch_dir):\n+                # There's a .git/patches/<branch> directory, which means\n+                # this is an initialized version 0 branch.\n+                return 0\n+            else:\n+                # The branch doesn't seem to be initialized at all.\n+                return None\n+        def set_format_version(v):\n+            out.info('Upgraded branch %s to format version %d' % (self.get_name(), v))\n+            config.set(self.format_version_key(), '%d' % v)\n+        def mkdir(d):\n+            if not os.path.isdir(d):\n+                os.makedirs(d)\n+        def rm(f):\n+            if os.path.exists(f):\n+                os.remove(f)\n+\n+        # Update 0 -> 1.\n+        if get_format_version() == 0:\n+            mkdir(os.path.join(branch_dir, 'trash'))\n+            patch_dir = os.path.join(branch_dir, 'patches')\n+            mkdir(patch_dir)\n+            refs_dir = os.path.join(self.__base_dir, 'refs', 'patches', self.get_name())\n+            mkdir(refs_dir)\n+            for patch in (file(os.path.join(branch_dir, 'unapplied')).readlines()\n+                          + file(os.path.join(branch_dir, 'applied')).readlines()):\n+                patch = patch.strip()\n+                os.rename(os.path.join(branch_dir, patch),\n+                          os.path.join(patch_dir, patch))\n+                Patch(patch, patch_dir, refs_dir).update_top_ref()\n+            set_format_version(1)\n+\n+        # Update 1 -> 2.\n+        if get_format_version() == 1:\n+            desc_file = os.path.join(branch_dir, 'description')\n+            if os.path.isfile(desc_file):\n+                desc = read_string(desc_file)\n+                if desc:\n+                    config.set('branch.%s.description' % self.get_name(), desc)\n+                rm(desc_file)\n+            rm(os.path.join(branch_dir, 'current'))\n+            rm(os.path.join(self.__base_dir, 'refs', 'bases', self.get_name()))\n+            set_format_version(2)\n+\n+        # Make sure we're at the latest version.\n+        if not get_format_version() in [None, FORMAT_VERSION]:\n+            raise StackException('Branch %s is at format version %d, expected %d'\n+                                 % (self.get_name(), get_format_version(), FORMAT_VERSION))\n+\n     def __patch_name_valid(self, name):\n         \"\"\"Raise an exception if the patch name is not valid.\n         \"\"\"\n@@ -584,7 +584,7 @@ class Series(PatchSet):\n         os.makedirs(self.__refs_dir)\n         self._set_field('orig-base', git.get_head())\n \n-        config.set(format_version_key(self.get_name()), str(FORMAT_VERSION))\n+        config.set(self.format_version_key(), str(FORMAT_VERSION))\n \n     def rename(self, to_name):\n         \"\"\"Renames a series\n"},{"id":"44677","messageId":"20070611003341.4736.49364.stgit@gandelf.nowhere.earth","threadId":"8552","inReplyTo":"20070611003117.4736.33551.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 4/4] Rename branch.*.stgitformatversion to branch.*.stgit.stackformatversion.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-11T00:33:41Z","receivedAt":"2007-06-11T00:33:41Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"Nearly as discussed on the ml, with the name slightly modified to\nbetter allow other types of PatchSet.\n---\n\n stgit/stack.py |   10 ++++++++--\n 1 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 89b5a55..634588d 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -366,7 +366,7 @@ class Series(PatchSet):\n         self.__trash_dir = os.path.join(self._dir(), 'trash')\n \n     def format_version_key(self):\n-        return 'branch.%s.stgitformatversion' % self.get_name()\n+        return 'branch.%s.stgit.stackformatversion' % self.get_name()\n \n     def update_to_current_format_version(self):\n         \"\"\"Update a potentially older StGIT directory structure to the\n@@ -379,11 +379,17 @@ class Series(PatchSet):\n             \"\"\"Return the integer format version number, or None if the\n             branch doesn't have any StGIT metadata at all, of any version.\"\"\"\n             fv = config.get(self.format_version_key())\n+            ofv = config.get('branch.%s.stgitformatversion' % self.get_name())\n             if fv:\n                 # Great, there's an explicitly recorded format version\n                 # number, which means that the branch is initialized and\n                 # of that exact version.\n                 return int(fv)\n+            elif ofv:\n+                # Old name for the version info, upgrade it\n+                config.set(self.format_version_key(), ofv)\n+                config.unset('branch.%s.stgitformatversion' % self.get_name())\n+                return int(ofv)\n             elif os.path.isdir(os.path.join(branch_dir, 'patches')):\n                 # There's a .git/patches/<branch>/patches dirctory, which\n                 # means this is an initialized version 1 branch.\n@@ -713,7 +719,7 @@ class Series(PatchSet):\n         config.unset('branch.%s.remote' % self.get_name())\n         config.unset('branch.%s.merge' % self.get_name())\n         config.unset('branch.%s.stgit.parentbranch' % self.get_name())\n-        config.unset('branch.%s.stgitformatversion' % self.get_name())\n+        config.unset(self.format_version_key())\n \n     def refresh_patch(self, files = None, message = None, edit = False,\n                       show_patch = False,\n"},{"id":"44877","messageId":"b0943d9e0706121509j5088e164iadedb561501d6a55@mail.gmail.com","threadId":"8552","inReplyTo":"20070611003330.4736.69293.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-12T22:09:50Z","receivedAt":"2007-06-12T22:09:50Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 11/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> The goal is to move into PatchSet all functionnality that is not\n> dependant of Series being a real stack, paving the way for handling\n> parallel (hydra) stacks, or any other way to organize patches.\n\nThanks for the patches. I applied this one as well and I like the\nidea. What is your long-term plan with this split?\n\nThe HEAD in my repository fails the test suite. Do you have any\nadditional patches pending (some patches were not applied in order as\nI had to manually fix the conflicts). Anyway, please check my\nrepository for any missing patches.\n\nThanks.\n\n-- \nCatalin\n"},{"id":"45000","messageId":"20070613203821.GQ6992@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8552","inReplyTo":"b0943d9e0706121509j5088e164iadedb561501d6a55@mail.gmail.com","subject":"Re: [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-13T20:38:21Z","receivedAt":"2007-06-13T20:38:21Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Tue, Jun 12, 2007 at 11:09:50PM +0100, Catalin Marinas wrote:\n> On 11/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> >The goal is to move into PatchSet all functionnality that is not\n> >dependant of Series being a real stack, paving the way for handling\n> >parallel (hydra) stacks, or any other way to organize patches.\n> \n> Thanks for the patches. I applied this one as well and I like the\n> idea. What is your long-term plan with this split?\n\nI have started to work on a Hydra class (available at [1], but be\naware it doesn't do much more than creating an octopus, and breaking\nmany current StGIT assumptions), with a testcase to demonstrate its\nuse), which binds together a set of stacks with an octopus, to allow\nkeeping related patches together, and allow people to pull from one\ntopic stack without getting unrelated work.\n\nI'm however facing a problem, with the pervasive assumption that we\nonly have stacks :).  Basically, we probably need a factory of\nPatchSet objects, which would return a Series or an Hydra according to\nthe specified name - I'm currently thinking about this, but don't\nexpect any working code too rapidly.\n\n\n> The HEAD in my repository fails the test suite. Do you have any\n> additional patches pending (some patches were not applied in order as\n> I had to manually fix the conflicts). Anyway, please check my\n> repository for any missing patches.\n\nOh, I had not noticed you had applied\nbd69feaf7c3c94b6e7e216ea8091064af9cdfa97.  Sorry, I was not explicit\nenough when posing this, only the cover mail included \"RFC\" in the\nsubject.  As described in that mail, there are problems both with the\noriginal approach (Karl's test failing), and with that new one (that\nexisiting test failing).\n\nDo you have any idea on how we could overcome the problem ?  In the\nmeantime, we could possibly just comment that testcase out (or add\nsupport for continuing the testsuite even with a failure) - the\nproblem it exhibits is probably less common than the one that was\nfixed.\n\nBTW, a02ba4077f12578fe31c99d903488804a656e1c4 has a slight problem: it\nis a patch by Karl, which I re-sent in the same group since it was\nexhibiting the problem (and with the intent of adding a signed-off-by\nline, but my way of adding them trough a buggy template showed its\nlimits and the commit now have 2 signed-off-by lines with Karl's\nname).  However, it was applied with myself as author, which is quite\nwrong: could that be a but in \"stg import\" ignoring the Author field ?\n\nBest regards,\n-- \nYann.\n\n[1] http://repo.or.cz/w/stgit/ydirson.git\n"},{"id":"45093","messageId":"20070614213032.GR6992@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8552","inReplyTo":"20070613203821.GQ6992@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: StGIT rebasing safeguard","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-14T21:30:32Z","receivedAt":"2007-06-14T21:30:32Z","isPatch":false,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Wed, Jun 13, 2007 at 10:38:21PM +0200, Yann Dirson wrote:\n> > The HEAD in my repository fails the test suite. Do you have any\n> > additional patches pending (some patches were not applied in order as\n> > I had to manually fix the conflicts). Anyway, please check my\n> > repository for any missing patches.\n> \n> Oh, I had not noticed you had applied\n> bd69feaf7c3c94b6e7e216ea8091064af9cdfa97.  Sorry, I was not explicit\n> enough when posing this, only the cover mail included \"RFC\" in the\n> subject.  As described in that mail, there are problems both with the\n> original approach (Karl's test failing), and with that new one (that\n> exisiting test failing).\n> \n> Do you have any idea on how we could overcome the problem ?  In the\n> meantime, we could possibly just comment that testcase out (or add\n> support for continuing the testsuite even with a failure) - the\n> problem it exhibits is probably less common than the one that was\n> fixed.\n\nWell, the patch I just sent which adds GIT_SKIP_TESTS support allows\nto see that this patch indeed breaks another test - the testsuite can\nbe forced to skip them [1] for the sake of checking one did not break\nanything else, but the second test that does not pass is annoying as\nwell, due to a similar problem:\n\nWhen the parent branch is a rewinding one (eg. an stgit stack), then\nthe old version of the patch will be turned to unreachable by\npull/rebase, and we probably have even no way of telling stgit that it\nis indeed expected, since the parent stack is a local one.  My own\nworkflow on StGIT is affected by the issue, since my \"bugs\" stack is\nforked off my \"master\" stack (but hopefully an hydra will help me ;).\n\nThat makes me suspecting the reachability approach is a dead-end, and\nwe should either get back to the approach of recording old-base, or\nfind another solution.\n\nBest regards,\n-- \nYann\n\n[1] GIT_SKIP_TESTS='t2100.4 t2102.3' make test\n"},{"id":"45096","messageId":"b0943d9e0706141556w1fb280dbu12e55dc91f6d5941@mail.gmail.com","threadId":"8552","inReplyTo":"20070613203821.GQ6992@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-14T22:56:47Z","receivedAt":"2007-06-14T22:56:47Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 13/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> I have started to work on a Hydra class (available at [1], but be\n> aware it doesn't do much more than creating an octopus, and breaking\n> many current StGIT assumptions), with a testcase to demonstrate its\n> use), which binds together a set of stacks with an octopus, to allow\n> keeping related patches together, and allow people to pull from one\n> topic stack without getting unrelated work.\n\nIf it works, it would be really useful. Do the stacks need to be\nindependent? I can group my patches easily (and I was thinking about\n\"collapse/expand\" commands for better viewing) but one stack might\nstill depend on patches from a different one. It would be nice if one\ncould also set the base of a series in this kind of hydra structure\n(unless it makes it difficult to understand).\n\n> > The HEAD in my repository fails the test suite. Do you have any\n> > additional patches pending (some patches were not applied in order as\n> > I had to manually fix the conflicts). Anyway, please check my\n> > repository for any missing patches.\n>\n> Oh, I had not noticed you had applied\n> bd69feaf7c3c94b6e7e216ea8091064af9cdfa97.  Sorry, I was not explicit\n> enough when posing this, only the cover mail included \"RFC\" in the\n> subject.\n\nOK, they were left as unread in my inbox and thought they were new.\n\n> As described in that mail, there are problems both with the\n> original approach (Karl's test failing), and with that new one (that\n> exisiting test failing).\n>\n> Do you have any idea on how we could overcome the problem ?  In the\n> meantime, we could possibly just comment that testcase out (or add\n> support for continuing the testsuite even with a failure) - the\n> problem it exhibits is probably less common than the one that was\n> fixed.\n\nI am happy with only 2 modes - one using ORIG_HEAD for people using\nStGIT in combination with plain GIT and the other overriding the base\nwithout checks. The second mode is for people not mixing StGIT with\nplain GIT. For the first mode, they have to deal with conflicts as\nwith the standard GIT.\n\n> BTW, a02ba4077f12578fe31c99d903488804a656e1c4 has a slight problem: it\n> is a patch by Karl, which I re-sent in the same group since it was\n> exhibiting the problem (and with the intent of adding a signed-off-by\n> line, but my way of adding them trough a buggy template showed its\n> limits and the commit now have 2 signed-off-by lines with Karl's\n> name).  However, it was applied with myself as author, which is quite\n> wrong: could that be a but in \"stg import\" ignoring the Author field ?\n\nIt's not a bug. The import command just uses the e-mail sender or a\n\"From:\" line before the patch description (see the default mail\ntemplate). It doesn't check the sign lines (it is following the kernel\npatch submission guidelines).\n\nI would drop both the above commits for release 0.13. Are you OK with this?\n\n-- \nCatalin\n"},{"id":"45148","messageId":"20070615201439.GT6992@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8552","inReplyTo":"b0943d9e0706141556w1fb280dbu12e55dc91f6d5941@mail.gmail.com","subject":"Re: [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-15T20:14:39Z","receivedAt":"2007-06-15T20:14:39Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Thu, Jun 14, 2007 at 11:56:47PM +0100, Catalin Marinas wrote:\n> On 13/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> >I have started to work on a Hydra class (available at [1], but be\n> >aware it doesn't do much more than creating an octopus, and breaking\n> >many current StGIT assumptions), with a testcase to demonstrate its\n> >use), which binds together a set of stacks with an octopus, to allow\n> >keeping related patches together, and allow people to pull from one\n> >topic stack without getting unrelated work.\n> \n> If it works, it would be really useful. Do the stacks need to be\n> independent? I can group my patches easily (and I was thinking about\n> \"collapse/expand\" commands for better viewing) but one stack might\n> still depend on patches from a different one. It would be nice if one\n> could also set the base of a series in this kind of hydra structure\n> (unless it makes it difficult to understand).\n\nIndeed one of the things that naturally come to mind after hydra, is\nto abstract a parent class above PatchSet and Patch, and allow those\nto be mostly used everywhere one of them is allowed.\n\nThat way we can have a (sub-)stack anywhere between 2 patches in a\nstack, and that should I think address the need you describe.  But\nthat would also allow to have an hydra built of single patches instead\nof stacks, which would be quite similar to how darcs organizes\npatches.  Combinations are endless, and I don't even count the\npossibility of adding new structures besides stacks and hydras :)\n\n\n> >As described in that mail, there are problems both with the\n> >original approach (Karl's test failing), and with that new one (that\n> >exisiting test failing).\n> >\n> >Do you have any idea on how we could overcome the problem ?  In the\n> >meantime, we could possibly just comment that testcase out (or add\n> >support for continuing the testsuite even with a failure) - the\n> >problem it exhibits is probably less common than the one that was\n> >fixed.\n> \n> I am happy with only 2 modes - one using ORIG_HEAD for people using\n> StGIT in combination with plain GIT and the other overriding the base\n> without checks. The second mode is for people not mixing StGIT with\n> plain GIT. For the first mode, they have to deal with conflicts as\n> with the standard GIT.\n\nWell, I have to think about that in details - but right now I'm a bit\nbusy with the hydra thing.\n\n\n> >BTW, a02ba4077f12578fe31c99d903488804a656e1c4 has a slight problem: it\n> >is a patch by Karl, which I re-sent in the same group since it was\n> >exhibiting the problem (and with the intent of adding a signed-off-by\n> >line, but my way of adding them trough a buggy template showed its\n> >limits and the commit now have 2 signed-off-by lines with Karl's\n> >name).  However, it was applied with myself as author, which is quite\n> >wrong: could that be a but in \"stg import\" ignoring the Author field ?\n> \n> It's not a bug. The import command just uses the e-mail sender or a\n> \"From:\" line before the patch description (see the default mail\n> template). It doesn't check the sign lines (it is following the kernel\n> patch submission guidelines).\n\nWe could surely improve things (and I'm not suggesting we should look\nat sign lines).  Eg, by having stg-mail add an Author pseudo-header\nwhen the patch author is different from the sender, and having\nstg-import use that when available.\n\n\n> I would drop both the above commits for release 0.13. Are you OK with this?\n\nSeems reasonable: the previous situation only seems to hurt when using\na workflow not involving stgit alone, whereas with this patch we also\nbreak stgit-only workflows.\n\nBest regards,\n-- \nYann.\n"},{"id":"45386","messageId":"b0943d9e0706191512l5f19b80v5b5be9151be13025@mail.gmail.com","threadId":"8552","inReplyTo":"20070614213032.GR6992@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: StGIT rebasing safeguard","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-19T22:12:30Z","receivedAt":"2007-06-19T22:12:30Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 14/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> When the parent branch is a rewinding one (eg. an stgit stack), then\n> the old version of the patch will be turned to unreachable by\n> pull/rebase, and we probably have even no way of telling stgit that it\n> is indeed expected, since the parent stack is a local one.  My own\n> workflow on StGIT is affected by the issue, since my \"bugs\" stack is\n> forked off my \"master\" stack (but hopefully an hydra will help me ;).\n\nIf I understand correctly, is this the case where you do a 'stg\ncommit'? This command is meant for branches that are never rebased\n(i.e. my master stgit branch). For this branch one wouldn't have a\nremote branch configured and hence git fetch shouldn't do anything.\n\n> That makes me suspecting the reachability approach is a dead-end, and\n> we should either get back to the approach of recording old-base, or\n> find another solution.\n\nMaybe defaulting to 'git pull' and only use 'git fetch' if explicitly\nasked. A git-pull would still keep the old patch accessible from HEAD.\n\n-- \nCatalin\n"},{"id":"45387","messageId":"b0943d9e0706191518o6396a2c5u1fb4f0953dc85aa@mail.gmail.com","threadId":"8552","inReplyTo":"b0943d9e0706191512l5f19b80v5b5be9151be13025@mail.gmail.com","subject":"Re: StGIT rebasing safeguard","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-19T22:18:56Z","receivedAt":"2007-06-19T22:18:56Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 19/06/07, Catalin Marinas <catalin.marinas@gmail.com> wrote:\n> On 14/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> > When the parent branch is a rewinding one (eg. an stgit stack), then\n> > the old version of the patch will be turned to unreachable by\n> > pull/rebase, and we probably have even no way of telling stgit that it\n> > is indeed expected, since the parent stack is a local one.  My own\n> > workflow on StGIT is affected by the issue, since my \"bugs\" stack is\n> > forked off my \"master\" stack (but hopefully an hydra will help me ;).\n>\n> If I understand correctly, is this the case where you do a 'stg\n> commit'? This command is meant for branches that are never rebased\n> (i.e. my master stgit branch). For this branch one wouldn't have a\n> remote branch configured and hence git fetch shouldn't do anything.\n\nI got confused - you were talking about 'stg rebase' rather than the\n'pull' strategy. But the question remains - are you referring to the\nuser running 'stg commit' and losing this commit after a rebase?\n\nThe rebase should be equivalent to a git-reset but with\npopping/pushing of the patches one the stack. Once committed, the\npatch is no longer managed by StGIT and therefore we shouldn't care.\n\n-- \nCatalin\n"},{"id":"45388","messageId":"b0943d9e0706191532w11439866u5a9c1b540d5ccca8@mail.gmail.com","threadId":"8552","inReplyTo":"20070615201439.GT6992@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: [StGIT PATCH 2/4] Abstract a PatchSet object out of Series.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-19T22:32:54Z","receivedAt":"2007-06-19T22:32:54Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 15/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> Indeed one of the things that naturally come to mind after hydra, is\n> to abstract a parent class above PatchSet and Patch, and allow those\n> to be mostly used everywhere one of them is allowed.\n>\n> That way we can have a (sub-)stack anywhere between 2 patches in a\n> stack, and that should I think address the need you describe.  But\n> that would also allow to have an hydra built of single patches instead\n> of stacks, which would be quite similar to how darcs organizes\n> patches.  Combinations are endless, and I don't even count the\n> possibility of adding new structures besides stacks and hydras :)\n\nIf you can track the patch dependencies, it would be enough to no\nlonger have a stack but a pool of patches (like darcs but without\nexact patch commuting, the diff3 merging provides a good approximation\nof this operation and in a much faster time). Simple patch dependency\ncould be detected by trying to apply a patch without others (it can be\noptimised so that only patches touching common files should be\nchecked).\n\n> > It's not a bug. The import command just uses the e-mail sender or a\n> > \"From:\" line before the patch description (see the default mail\n> > template). It doesn't check the sign lines (it is following the kernel\n> > patch submission guidelines).\n>\n> We could surely improve things (and I'm not suggesting we should look\n> at sign lines).  Eg, by having stg-mail add an Author pseudo-header\n> when the patch author is different from the sender, and having\n> stg-import use that when available.\n\nBut the 'stg mail' command already adds a \"From:\" line in the body\n(with the default template) and 'import' checks for 'From:' or\n'Author:' which override the e-mail sender. You might be using a\ndifferent e-mail template.\n\n-- \nCatalin\n"},{"id":"45389","messageId":"20070619223700.GA7730@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8552","inReplyTo":"b0943d9e0706191518o6396a2c5u1fb4f0953dc85aa@mail.gmail.com","subject":"Re: StGIT rebasing safeguard","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-19T22:37:00Z","receivedAt":"2007-06-19T22:37:00Z","isPatch":false,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Tue, Jun 19, 2007 at 11:18:56PM +0100, Catalin Marinas wrote:\n> On 19/06/07, Catalin Marinas <catalin.marinas@gmail.com> wrote:\n> >On 14/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> >> When the parent branch is a rewinding one (eg. an stgit stack), then\n> >> the old version of the patch will be turned to unreachable by\n> >> pull/rebase, and we probably have even no way of telling stgit that it\n> >> is indeed expected, since the parent stack is a local one.  My own\n> >> workflow on StGIT is affected by the issue, since my \"bugs\" stack is\n> >> forked off my \"master\" stack (but hopefully an hydra will help me ;).\n> >\n> >If I understand correctly, is this the case where you do a 'stg\n> >commit'? This command is meant for branches that are never rebased\n> >(i.e. my master stgit branch). For this branch one wouldn't have a\n> >remote branch configured and hence git fetch shouldn't do anything.\n> \n> I got confused - you were talking about 'stg rebase' rather than the\n> 'pull' strategy. But the question remains - are you referring to the\n> user running 'stg commit' and losing this commit after a rebase?\n\nNot at all.  I'm talking about an stgit stack, whose base is the head\nof another stack (eg. a \"pu\" branch).  When you want to rebase, the\nold heads/pu is only reachable from your stack base.\n\nMaybe we can use the parent's reflog, but I'm not sure it would cover\nall cases, and a reflog can possibly be expired before the information\nin there gets used.\n\n\n> The rebase should be equivalent to a git-reset but with\n> popping/pushing of the patches one the stack. Once committed, the\n> patch is no longer managed by StGIT and therefore we shouldn't care.\n\nThat is another issue - and I rather believe we should not allow a\nuser to do that without --force, if what he committed will be\nunreachable after rebasing.  If he intended to loose it, he would\nusually rather have used \"stg delete\" than such a convoluted sequence\nof actions :)\n\nBest regards,\n-- \nYann.\n"}]}