All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull"
Date: Mon, 08 Oct 2007 01:18:30 +0200	[thread overview]
Message-ID: <20071007231830.12626.30574.stgit@yoghurt> (raw)
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>

Instead, always behave as if the force flag was given; that is, don't
check if rebasing would leave a dangling commit behind. Reasons:

  * The check for this was very strict and caused a lot of false
    positives.

  * Everything is recorded in the reflog, so we can't actually lose
    commits.

This fixes bug 9181.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/common.py      |    9 +--------
 stgit/commands/pull.py        |    5 +----
 stgit/commands/rebase.py      |    5 +----
 stgit/stack.py                |    1 -
 t/t2100-pull-policy-fetch.sh  |   14 --------------
 t/t2102-pull-policy-rebase.sh |   24 ------------------------
 6 files changed, 3 insertions(+), 55 deletions(-)


diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 27a616f..9815400 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -318,14 +318,7 @@ def address_or_alias(addr_str):
                  for addr in addr_str.split(',')]
     return ', '.join([addr for addr in addr_list if addr])
 
-def prepare_rebase(force=None):
-    if not force:
-        # Be sure we won't loose results of stg-(un)commit by error.
-        # Do not require an existing orig-base for compatibility with 0.12 and earlier.
-        origbase = crt_series._get_field('orig-base')
-        if origbase and crt_series.get_base() != origbase:
-            raise CmdException, 'Rebasing would possibly lose data'
-
+def prepare_rebase():
     # pop all patches
     applied = crt_series.get_applied()
     if len(applied) > 0:
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 070db99..237bdd9 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -43,9 +43,6 @@ options = [make_option('-n', '--nopush',
                        action = 'store_true'),
            make_option('-m', '--merged',
                        help = 'check for patches merged upstream',
-                       action = 'store_true'),
-           make_option('--force',
-                       help = 'force rebase even if the stack based was moved by (un)commits',
                        action = 'store_true')]
 
 def func(parser, options, args):
@@ -81,7 +78,7 @@ def func(parser, options, args):
     if policy not in ['pull', 'fetch-rebase', 'rebase']:
         raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
 
-    applied = prepare_rebase(force=options.force)
+    applied = prepare_rebase()
 
     # pull the remote changes
     if policy == 'pull':
diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index c68f8e7..513729a 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -34,9 +34,6 @@ options = [make_option('-n', '--nopush',
                        action = 'store_true'),
            make_option('-m', '--merged',
                        help = 'check for patches merged upstream',
-                       action = 'store_true'),
-           make_option('--force',
-                       help = 'force rebase even if the stack based was moved by (un)commits',
                        action = 'store_true')]
 
 def func(parser, options, args):
@@ -56,7 +53,7 @@ def func(parser, options, args):
     if git_id(args[0]) == None:
         raise GitException, 'Unknown revision: %s' % args[0]
         
-    applied = prepare_rebase(force=options.force)
+    applied = prepare_rebase()
     rebase(args[0])
     post_rebase(applied, options.nopush, options.merged)
 
diff --git a/stgit/stack.py b/stgit/stack.py
index bdb4e38..94856b8 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -623,7 +623,6 @@ class Series(PatchSet):
 
         self.create_empty_field('applied')
         self.create_empty_field('unapplied')
-        self._set_field('orig-base', git.get_head())
 
         config.set(self.format_version_key(), str(FORMAT_VERSION))
 
diff --git a/t/t2100-pull-policy-fetch.sh b/t/t2100-pull-policy-fetch.sh
index 1f50069..28901b1 100755
--- a/t/t2100-pull-policy-fetch.sh
+++ b/t/t2100-pull-policy-fetch.sh
@@ -55,18 +55,4 @@ test_expect_success \
     test `wc -l <clone/file2` = 3
     '
 
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
-    'New upstream commit and commit a patch in clone' \
-    '
-    (cd upstream && stg new u2 -m u2 &&
-     echo a > file3 && stg add file3 && stg refresh) &&
-    (cd clone && stg commit && stg new c2 -m c2 &&
-     echo a >> file && stg refresh)
-    '
-test_expect_success \
-    'Try to  and commit a patch in clone' \
-    '(cd clone && ! stg pull)'
-
 test_done
diff --git a/t/t2102-pull-policy-rebase.sh b/t/t2102-pull-policy-rebase.sh
index b2fbfcf..ce2e32f 100755
--- a/t/t2102-pull-policy-rebase.sh
+++ b/t/t2102-pull-policy-rebase.sh
@@ -36,28 +36,4 @@ test_expect_success \
     test `wc -l <file2` = 2
     '
 
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
-    'New commit in parent and commit a patch in stack' \
-    '
-    stg branch parent && stg new u2 -m u2 &&
-     echo c > file3 && stg add file3 && stg refresh &&
-    stg branch stack && stg commit && stg new c2 -m c2 &&
-     echo a >> file && stg refresh
-    '
-test_expect_success \
-    'Try to pull/rebase now that stack base has moved' \
-    '! stg pull'
-
-test_expect_success \
-    'Force the pull/rebase, but do not push yet' \
-    'stg pull --force --nopush'
-test_expect_success \
-    '...check we lost the committed patch' \
-    '! test -e file'
-test_expect_success \
-    '...and check we get a conflict while pushing' \
-    '! stg push'
-
 test_done

      parent reply	other threads:[~2007-10-07 23:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 1/8] Add --ack/--sign options to "stg new" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 2/8] New test: "stg pop --keep" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 3/8] Fix up the help text for "stg edit" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 4/8] Don't split long and short description in " Karl Hasselström
2007-10-07 23:40   ` David Brown
2007-10-08  6:41     ` Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 5/8] Make a common superclass for all StGit exceptions Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 6/8] Simplify debug level error checking Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 7/8] Discard stderr output from git-rev-parse Karl Hasselström
2007-10-07 23:18 ` Karl Hasselström [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071007231830.12626.30574.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.