* [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull"
From: Karl Hasselström @ 2007-10-07 23:18 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
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
^ permalink raw reply related
* [StGit PATCH 7/8] Discard stderr output from git-rev-parse
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
This gets rid of the annoying "fatal: Needed a single revision"
messages that were printed in addition to StGit's own error message.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/git.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/stgit/git.py b/stgit/git.py
index 0026fd8..812b77a 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -301,7 +301,8 @@ def rev_parse(git_id):
"""Parse the string and return a verified SHA1 id
"""
try:
- return GRun('git-rev-parse', '--verify', git_id).output_one_line()
+ return GRun('git-rev-parse', '--verify', git_id
+ ).discard_stderr().output_one_line()
except GitRunException:
raise GitException, 'Unknown revision: %s' % git_id
^ permalink raw reply related
* [StGit PATCH 6/8] Simplify debug level error checking
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/main.py | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/stgit/main.py b/stgit/main.py
index f54330d..19ba2bd 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -261,9 +261,7 @@ def main():
from stgit.stack import Series
try:
- debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
- except KeyError:
- debug_level = 0
+ debug_level = int(os.environ.get('STGIT_DEBUG_LEVEL', 0))
except ValueError:
out.error('Invalid STGIT_DEBUG_LEVEL environment variable')
sys.exit(1)
^ permalink raw reply related
* [StGit PATCH 5/8] Make a common superclass for all StGit exceptions
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
This makes it easier to catch them all. (Indeed, the very long list of
exceptions to catch in main.py was missing some of the exceptions.)
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/common.py | 5 +++--
stgit/config.py | 3 ++-
stgit/exception.py | 3 +++
stgit/git.py | 3 ++-
stgit/gitmergeonefile.py | 3 ++-
stgit/main.py | 11 +++--------
stgit/run.py | 5 +++--
stgit/stack.py | 3 ++-
stgit/utils.py | 3 ++-
9 files changed, 22 insertions(+), 17 deletions(-)
create mode 100644 stgit/exception.py
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 0fc157a..27a616f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os, os.path, re
from optparse import OptionParser, make_option
+from stgit.exception import *
from stgit.utils import *
from stgit.out import *
from stgit import stack, git, basedir
@@ -30,11 +31,11 @@ crt_series = None
# Command exception class
-class CmdException(Exception):
+class CmdException(StgException):
pass
# Utility functions
-class RevParseException(Exception):
+class RevParseException(StgException):
"""Revision spec parse error."""
pass
diff --git a/stgit/config.py b/stgit/config.py
index 51818bd..3eabc8c 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -20,9 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os, re
from stgit import basedir
+from stgit.exception import *
from stgit.run import *
-class GitConfigException(Exception):
+class GitConfigException(StgException):
pass
class GitConfig:
diff --git a/stgit/exception.py b/stgit/exception.py
new file mode 100644
index 0000000..9933e64
--- /dev/null
+++ b/stgit/exception.py
@@ -0,0 +1,3 @@
+class StgException(Exception):
+ """Base class for all StGit exceptions."""
+ pass
diff --git a/stgit/git.py b/stgit/git.py
index a0493bc..0026fd8 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os, re, gitmergeonefile
from shutil import copyfile
+from stgit.exception import *
from stgit import basedir
from stgit.utils import *
from stgit.out import *
@@ -28,7 +29,7 @@ from stgit.run import *
from stgit.config import config
# git exception class
-class GitException(Exception):
+class GitException(StgException):
pass
# When a subprocess has a problem, we want the exception to be a
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
index 2aa5ef8..058b6ac 100644
--- a/stgit/gitmergeonefile.py
+++ b/stgit/gitmergeonefile.py
@@ -19,13 +19,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
import sys, os
+from stgit.exception import *
from stgit import basedir
from stgit.config import config, file_extensions, ConfigOption
from stgit.utils import append_string
from stgit.out import *
from stgit.run import *
-class GitMergeException(Exception):
+class GitMergeException(StgException):
pass
diff --git a/stgit/main.py b/stgit/main.py
index 2c8716b..f54330d 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -255,13 +255,10 @@ def main():
# These modules are only used from this point onwards and do not
# need to be imported earlier
+ from stgit.exception import StgException
from stgit.config import config_setup
from ConfigParser import ParsingError, NoSectionError
- from stgit.stack import Series, StackException
- from stgit.git import GitException
- from stgit.commands.common import CmdException
- from stgit.gitmergeonefile import GitMergeException
- from stgit.utils import EditorException
+ from stgit.stack import Series
try:
debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
@@ -284,9 +281,7 @@ def main():
stgit.commands.common.crt_series = command.crt_series
command.func(parser, options, args)
- except (IOError, ParsingError, NoSectionError, CmdException,
- StackException, GitException, GitMergeException,
- EditorException), err:
+ except (StgException, IOError, ParsingError, NoSectionError), err:
print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
if debug_level > 0:
raise
diff --git a/stgit/run.py b/stgit/run.py
index 7986f3b..989bb27 100644
--- a/stgit/run.py
+++ b/stgit/run.py
@@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import datetime, os, subprocess
-from stgit.out import *
+from stgit.exception import *
+from stgit.out import *
-class RunException(Exception):
+class RunException(StgException):
"""Thrown when something bad happened when we tried to run the
subprocess."""
pass
diff --git a/stgit/stack.py b/stgit/stack.py
index 4d1a066..bdb4e38 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os, re
from email.Utils import formatdate
+from stgit.exception import *
from stgit.utils import *
from stgit.out import *
from stgit.run import *
@@ -30,7 +31,7 @@ from shutil import copyfile
# stack exception class
-class StackException(Exception):
+class StackException(StgException):
pass
class FilterUntil:
diff --git a/stgit/utils.py b/stgit/utils.py
index 857c0f0..3a480c0 100644
--- a/stgit/utils.py
+++ b/stgit/utils.py
@@ -2,6 +2,7 @@
"""
import errno, optparse, os, os.path, re, sys
+from stgit.exception import *
from stgit.config import config
from stgit.out import *
@@ -166,7 +167,7 @@ def rename(basedir, file1, file2):
# file1's parent dir may not be empty after move
pass
-class EditorException(Exception):
+class EditorException(StgException):
pass
def call_editor(filename):
^ permalink raw reply related
* [StGit PATCH 4/8] Don't split long and short description in "stg edit"
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
"stg edit" used to present the patch information like this:
Short description
From: ...
Date: ...
Long description
If the project follows the git convention with a single-line short
description and follwed by a blank line and the rest of the
description, this merely looks a little odd. However, for projects
that don't follow that convention, presenting the first line
separately is actively inconvenient; for example, it breaks emacs's
fill-paragraph command.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/edit.py | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index e968e25..223c628 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -36,12 +36,10 @@ diff.
The editor is invoked with the following contents:
- Patch short description
-
From: A U Thor <author@example.com>
Date: creation date
- Patch long description
+ Patch description
If --diff was specified, the diff appears at the bottom, after a
separator:
@@ -135,22 +133,15 @@ def __edit_update_patch(pname, options):
# generate the file to be edited
descr = patch.get_description().strip()
- descr_lines = descr.split('\n')
authdate = patch.get_authdate()
- short_descr = descr_lines[0].rstrip()
- long_descr = reduce(lambda x, y: x + '\n' + y,
- descr_lines[1:], '').strip()
-
- tmpl = '%(shortdescr)s\n\n' \
- 'From: %(authname)s <%(authemail)s>\n'
+ tmpl = 'From: %(authname)s <%(authemail)s>\n'
if authdate:
tmpl += 'Date: %(authdate)s\n'
- tmpl += '\n%(longdescr)s\n'
+ tmpl += '\n%(descr)s\n'
tmpl_dict = {
- 'shortdescr': short_descr,
- 'longdescr': long_descr,
+ 'descr': descr,
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate()
^ permalink raw reply related
* [StGit PATCH 3/8] Fix up the help text for "stg edit"
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
The sentence structure was strange, and the example format was
somewhat misleading (StGit doesn't care about sign-off lines, for
example).
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/edit.py | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index 63c710b..e968e25 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -30,19 +30,25 @@ from stgit import stack, git
help = 'edit a patch description or diff'
usage = """%prog [options] [<patch>]
-Edit the given patch (defaulting to the current one) description,
-author information or its diff (if the '--diff' option is
-passed). Without any other option, the command invokes the editor with
-the patch description and diff in the form below:
+Edit the description and author information of the given patch (or the
+current patch if no patch name was given). With --diff, also edit the
+diff.
- Subject line
+The editor is invoked with the following contents:
- From: author information
+ Patch short description
+
+ From: A U Thor <author@example.com>
Date: creation date
- Patch description
+ Patch long description
+
+If --diff was specified, the diff appears at the bottom, after a
+separator:
+
+ ---
- Signed-off-by: author
+ Diff text
Command-line options can be used to modify specific information
without invoking the editor.
@@ -54,7 +60,7 @@ these files using the '--file' and '--diff' options.
"""
options = [make_option('-d', '--diff',
- help = 'allow the editing of the patch diff',
+ help = 'edit the patch diff',
action = 'store_true'),
make_option('-f', '--file',
help = 'use FILE instead of invoking the editor'),
^ permalink raw reply related
* [StGit PATCH 2/8] New test: "stg pop --keep"
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t1204-pop-keep.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
create mode 100755 t/t1204-pop-keep.sh
diff --git a/t/t1204-pop-keep.sh b/t/t1204-pop-keep.sh
new file mode 100755
index 0000000..40cd2a2
--- /dev/null
+++ b/t/t1204-pop-keep.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='Test "stg pop -keep"'
+. ./test-lib.sh
+stg init
+
+test_expect_success 'Create a few patches' '
+ for i in 0 1 2; do
+ stg new p$i -m p$i &&
+ echo "patch$i" >> patch$i.txt &&
+ stg add patch$i.txt &&
+ stg refresh
+ done &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success 'Make some non-conflicting local changes' '
+ echo "local" >> patch0.txt
+'
+
+test_expect_success 'Pop two patches, keeping local changes' '
+ stg pop -n 2 --keep &&
+ [ "$(echo $(stg applied))" = "p0" ] &&
+ [ "$(echo $(stg unapplied))" = "p1 p2" ] &&
+ [ "$(echo $(ls patch?.txt))" = "patch0.txt" ] &&
+ [ "$(echo $(cat patch0.txt))" = "patch0 local" ]
+'
+
+test_expect_success 'Reset and push patches again' '
+ git reset --hard &&
+ stg push -a
+'
+
+test_expect_success 'Pop a patch without local changes' '
+ stg pop --keep &&
+ [ "$(echo $(stg applied))" = "p0 p1" ] &&
+ [ "$(echo $(stg unapplied))" = "p2" ] &&
+ [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]
+'
+
+test_done
^ permalink raw reply related
* [StGit PATCH 1/8] Add --ack/--sign options to "stg new"
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071007231446.12626.14259.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/new.py | 6 ++++--
stgit/stack.py | 10 +++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index f192e34..59671ab 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -54,7 +54,8 @@ options = [make_option('-m', '--message',
make_option('--commname',
help = 'use COMMNAME as the committer name'),
make_option('--commemail',
- help = 'use COMMEMAIL as the committer e-mail')]
+ help = 'use COMMEMAIL as the committer e-mail')
+ ] + make_sign_options()
def func(parser, options, args):
@@ -79,4 +80,5 @@ def func(parser, options, args):
author_email = options.authemail,
author_date = options.authdate,
committer_name = options.commname,
- committer_email = options.commemail)
+ committer_email = options.commemail,
+ sign_str = options.sign_str)
diff --git a/stgit/stack.py b/stgit/stack.py
index d889f37..4d1a066 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -847,7 +847,7 @@ class Series(PatchSet):
top = None, bottom = None, commit = True,
author_name = None, author_email = None, author_date = None,
committer_name = None, committer_email = None,
- before_existing = False):
+ before_existing = False, sign_str = None):
"""Creates a new patch, either pointing to an existing commit object,
or by creating a new commit object.
"""
@@ -865,13 +865,17 @@ class Series(PatchSet):
# TODO: move this out of the stgit.stack module, it is really
# for higher level commands to handle the user interaction
+ def sign(msg):
+ return add_sign_line(msg, sign_str,
+ committer_name or git.committer().name,
+ committer_email or git.committer().email)
if not message and can_edit:
descr = edit_file(
- self, None,
+ self, sign(''),
'Please enter the description for the patch above.',
show_patch)
else:
- descr = message
+ descr = sign(message)
head = git.get_head()
^ permalink raw reply related
* [StGit PATCH 0/8] Miscellaneous fixes and improvements
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
Also available from
git://repo.or.cz/stgit/kha.git safe
---
Karl Hasselström (8):
Remove the --force flag to "stg rebase" and "stg pull"
Discard stderr output from git-rev-parse
Simplify debug level error checking
Make a common superclass for all StGit exceptions
Don't split long and short description in "stg edit"
Fix up the help text for "stg edit"
New test: "stg pop --keep"
Add --ack/--sign options to "stg new"
stgit/commands/common.py | 14 ++++----------
stgit/commands/edit.py | 33 +++++++++++++++-----------------
stgit/commands/new.py | 6 ++++--
stgit/commands/pull.py | 5 +----
stgit/commands/rebase.py | 5 +----
stgit/config.py | 3 ++-
stgit/exception.py | 3 +++
stgit/git.py | 6 ++++--
stgit/gitmergeonefile.py | 3 ++-
stgit/main.py | 15 ++++-----------
stgit/run.py | 5 +++--
stgit/stack.py | 14 +++++++++-----
stgit/utils.py | 3 ++-
t/t1204-pop-keep.sh | 42 +++++++++++++++++++++++++++++++++++++++++
t/t2100-pull-policy-fetch.sh | 14 --------------
t/t2102-pull-policy-rebase.sh | 24 -----------------------
16 files changed, 96 insertions(+), 99 deletions(-)
create mode 100644 stgit/exception.py
create mode 100755 t/t1204-pop-keep.sh
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: git fetch -- double fetch
From: Daniel Barkalow @ 2007-10-07 23:14 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Johannes Schindelin, git
In-Reply-To: <20071007214433.GA30833@shadowen.org>
On Sun, 7 Oct 2007, Andy Whitcroft wrote:
> On Sun, Oct 07, 2007 at 05:29:38PM +0100, Johannes Schindelin wrote:
> > Hi,
> >
> > On Sat, 6 Oct 2007, Andy Whitcroft wrote:
> >
> > > I have recently been seeing repeated fetching of some branches. I feel
> > > this has happened in at least three of my repos on three distinct
> > > projects:
> > >
> > > apw@pinky$ git fetch origin
> > > remote: Generating pack...
> > > remote: Done counting 5 objects.
> > > remote: Deltifying 5 objects...
> > > remote: 100% (5/5) done
> > > Unpacking 5 objects...
> > > remote: Total 5 (delta 0), reused 0 (delta 0)
> > > 100% (5/5) done
> > > * refs/remotes/origin/master: fast forward to branch 'master' of ssh://git@abat-dev/var/www/git/abat
> > > old..new: ce046f0..41c9dde
> > > * refs/remotes/origin/master: fast forward to branch 'master' of ssh://git@abat-dev/var/www/git/abat
> > > old..new: ce046f0..41c9dde
> >
> > What does "git config --get-all remote.origin.fetch" say?
>
> apw@pinky$ git config --get-all remote.origin.fetch
> +refs/heads/master:refs/remotes/origin/master
> +refs/heads/*:refs/remotes/origin/*
> apw@pinky$
>
> I don't think that I did anything to this config, I think that is what
> the clone setup for me.
Ah, both the first line and the pattern match, and there's nothing at that
stage to filter out duplicates.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH 1/4] git-gui i18n: Add more words to glossary.
From: Shawn O. Pearce @ 2007-10-07 23:12 UTC (permalink / raw)
To: Christian Stimming; +Cc: Johannes Schindelin, git
In-Reply-To: <200710072242.26288.stimming@tuhh.de>
Christian Stimming <stimming@tuhh.de> wrote:
> Am Sonntag, 7. Oktober 2007 20:05 schrieb Shawn O. Pearce:
> > Christian Stimming <stimming@tuhh.de> wrote:
> > > Signed-off-by: Christian Stimming <stimming@tuhh.de>
> > >
> > > ---
> > > po/glossary/git-gui-glossary.pot | 12 ++++++++++--
> > > po/glossary/git-gui-glossary.txt | 2 ++
> > > 2 files changed, 12 insertions(+), 2 deletions(-)
> >
> > What version is this series applied to? It rejects against my
> > currently published master on repo.or.cz.
>
> It rejects? The patch were intended against master on git-gui.git on
> repo.or.cz; the base for the patches was
> 1952aa1d5735ccbedd832620e43db3e03fc77088
Right, that's what I tried to apply them to.
> I might have messed up some line wrappings... if that is the case, I can of
> course resend and try harder to send them correctly.
If you are sending a series like that and its all po translation
stuff that is unlikely to need commenting on feel free to just dump
it all out as a single mbox (`git format-patch --stdout`) and attach
it to the email. Less chance of the MUA mangling the message.
I'd rather not to this for code however, as myself or others may
want to reply with comments. Having it inline makes this task
much easier.
--
Shawn.
^ permalink raw reply
* Re: Many gits are offline this week
From: Shawn O. Pearce @ 2007-10-07 23:09 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Daniel Barkalow, Randal L. Schwartz, Paolo Ciarrocchi, git
In-Reply-To: <Pine.LNX.4.64.0710072331050.4174@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Sun, 7 Oct 2007, Daniel Barkalow wrote:
>
> > For that matter, gitweb is essentially a limited porcelain. And this
> > points out that all VCSes have alternative porcelains, but git is
> > unusual in having convenient plumbing to support and encourage this.
>
> I do not consider viewers "porcelain". And gitweb is essentially just a
> viewer.
So you don't consider gitk to be porcelain? I do. The plumbing
output of git-rev-list is uh, ugly. gitk may still not be the best
looking application on the internet but it sure beats looking at
rev-list output by eye.
Porcelain is really anything that calls plumbing to make the task
of invoking or processing the output of plumbing easier on the
human using it. That's it. Obviously you can work Git by just the
plumbing. Just like you can compute SHA-1 by hand. You just choose
not to as the time it would take is more than you want to invest.
Or have left in this mortal existance...
I almost always forget about the web interfaces. There's a number
of them and I don't use them often enough to really think about it.
I don't know why I always forget about them. I never forget about
StGit or qgit, and yet I never use those either...
--
Shawn.
^ permalink raw reply
* Re: Many gits are offline this week
From: Johannes Schindelin @ 2007-10-07 22:31 UTC (permalink / raw)
To: Daniel Barkalow
Cc: Shawn O. Pearce, Randal L. Schwartz, Paolo Ciarrocchi, git
In-Reply-To: <Pine.LNX.4.64.0710071457580.23070@iabervon.org>
Hi,
On Sun, 7 Oct 2007, Daniel Barkalow wrote:
> For that matter, gitweb is essentially a limited porcelain. And this
> points out that all VCSes have alternative porcelains, but git is
> unusual in having convenient plumbing to support and encourage this.
I do not consider viewers "porcelain". And gitweb is essentially just a
viewer.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Alex Riesen @ 2007-10-07 22:31 UTC (permalink / raw)
To: Wincent Colaiuta
Cc: David Kastrup, Miles Bader, Pierre Habouzit, Timo Hirvonen, git,
Junio C Hamano
In-Reply-To: <EF81F7DD-73C7-4B6F-92D2-4A143CA05365@wincent.com>
Wincent Colaiuta, Mon, Oct 08, 2007 00:12:17 +0200:
> El 7/10/2007, a las 23:54, Alex Riesen escribió:
>
> >>... All the rest pretty much
> >>was worse than what we started from in that it needed to reevaluate
> >>more conditions and turned out more complicated and obfuscate even to
> >>the human reader.
> >
> >it _is_ smaller. And it is _measurably_ faster on that thing I have at
> >home (and old p4).
>
> Can we see the numbers and the steps used to obtain them? I'm also a
> little bit confused about how an inlined function can lead to a
> smaller executable... or did you just mean lines-of-code?
I did mean the bytes of object code. I never said it produces a
smaller executable.
I compiled with gcc -O2 and -O4, gcc 4.1.2 (Ubuntu 4.1.2-0ubuntu4).
Cut the functions out into their own files and compile them to get the
object code. Compile with -S (assembly) to examine the generated code.
Compare.
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
struct strbuf {
size_t alloc;
size_t len;
char *buf;
};
int strbuf_cmp2(struct strbuf *a, struct strbuf *b)
{
int len = a->len < b->len ? a->len: b->len;
int cmp = memcmp(a->buf, b->buf, len);
if (cmp)
return cmp;
return a->len < b->len ? -1: a->len != b->len;
}
int strbuf_cmp1(struct strbuf *a, struct strbuf *b)
{
int cmp;
if (a->len < b->len) {
cmp = memcmp(a->buf, b->buf, a->len);
return cmp ? cmp : -1;
} else {
cmp = memcmp(a->buf, b->buf, b->len);
return cmp ? cmp : a->len != b->len;
}
}
int main(int argc, char *argv[], char *envp[])
{
struct strbuf s1 = {
.alloc = 0,
.len = 50,
.buf = "01234567890123456789012345678901234567890123456789",
};
struct strbuf s2 = {
.alloc = 0,
.len = 50,
.buf = "0123456789012345678901234567890123456789",
};
struct strbuf s3 = {
.alloc = 0,
.len = 50,
.buf = "0123456789012345678901234567890123456789012345678x",
};
struct timeval tv1, tv2, diff;
unsigned n;
int result;
#define CYCLES 0xffffffffu
strbuf_cmp1(&s1, &s2);
strbuf_cmp1(&s2, &s3);
result = 0;
gettimeofday(&tv1, NULL);
for (n = CYCLES; n--; ) {
result += strbuf_cmp1(&s1, &s2);
result += strbuf_cmp1(&s2, &s3);
result += strbuf_cmp1(&s1, &s3);
result += strbuf_cmp1(&s1, &s1);
result += n;
}
gettimeofday(&tv2, NULL);
timersub(&tv2, &tv1, &diff);
printf("ph=%ld.%ld (%d)\n", diff.tv_sec, diff.tv_usec, result);
strbuf_cmp2(&s1, &s2);
strbuf_cmp2(&s2, &s3);
result = 0;
gettimeofday(&tv1, NULL);
for (n = CYCLES; n--; ) {
result += strbuf_cmp2(&s1, &s2);
result += strbuf_cmp2(&s2, &s3);
result += strbuf_cmp2(&s1, &s3);
result += strbuf_cmp2(&s1, &s1);
result += n;
}
gettimeofday(&tv2, NULL);
timersub(&tv2, &tv1, &diff);
printf("ar=%ld.%ld (%d)\n", diff.tv_sec, diff.tv_usec, result);
return 0;
}
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Elijah Newren @ 2007-10-07 22:24 UTC (permalink / raw)
To: Alex Riesen; +Cc: Frank Lichtenheld, git
In-Reply-To: <20071007221920.GF2765@steel.home>
On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:
<snip>
> rm -rf .git/refs/original/refs/heads/<the branch where HEAD pointed to>
> (assuming you haven't repacked yet)
>
> or just edit .git/packed-refs and remove everything "refs/original"
> which fits the criteria
>
> > So...how do I fix the reflog, and then repack to have a
> > pack under 11MB in size?
>
> git reflog expire --all (it is a bit to much. You can just edit
> .git/logs/* in any text editor)
So...
$ du -hs .
11M .
$ rm -rf .git/refs/original/
$ vi .git/packed-refs
# Remove the line referring to refs/original...
$ git reflog expire --all
$ git gc --aggressive --prune
$ du -hs .
11M .
It's still 11MB.
Any other ideas?
Elijah
^ permalink raw reply
* Re: [PATCH] setup/rev-parse: allow HEAD to be spelled 'head'
From: Sam Vilain @ 2007-10-07 22:23 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710071747340.4174@racer.site>
Johannes Schindelin wrote:
> P.S.: seems you have quite cute coworkers.
http://xkcd.com/322/
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Alex Riesen @ 2007-10-07 22:19 UTC (permalink / raw)
To: Elijah Newren; +Cc: Frank Lichtenheld, git
In-Reply-To: <51419b2c0710071500x318ee734n9db6ca9e6daa3196@mail.gmail.com>
Elijah Newren, Mon, Oct 08, 2007 00:00:51 +0200:
> On 10/7/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:
> > On Sun, Oct 07, 2007 at 03:23:59PM -0600, Elijah Newren wrote:
> > > The following set of instructions will duplicate my problem with a
> > > smaller repo; why is the local git repository bigger after running
> > > git-filter-branch rather than smaller as I'd expect? I'm probably
> > > missing something obvious, but I have no idea what it is.
> >
> > The usual suspect would be the reflog.
>
> The git-filter-branch documentation mentions creating refs/original
> under .git. Unfortunately, it doesn't contain any links or
> documentation on how I'd clean those out and I haven't been able to
> figure it out. I asked on #git how to clean these out and got some
> answers that didn't work (git branch -d and something else I don't
> remember).
rm -rf .git/refs/original/refs/heads/<the branch where HEAD pointed to>
(assuming you haven't repacked yet)
or just edit .git/packed-refs and remove everything "refs/original"
which fits the criteria
> So...how do I fix the reflog, and then repack to have a
> pack under 11MB in size?
git reflog expire --all (it is a bit to much. You can just edit
.git/logs/* in any text editor)
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Wincent Colaiuta @ 2007-10-07 22:12 UTC (permalink / raw)
To: Alex Riesen
Cc: David Kastrup, Miles Bader, Pierre Habouzit, Timo Hirvonen, git,
Junio C Hamano
In-Reply-To: <20071007215432.GC2765@steel.home>
El 7/10/2007, a las 23:54, Alex Riesen escribió:
>> ... All the rest pretty much
>> was worse than what we started from in that it needed to reevaluate
>> more conditions and turned out more complicated and obfuscate even to
>> the human reader.
>
> it _is_ smaller. And it is _measurably_ faster on that thing I have at
> home (and old p4).
Can we see the numbers and the steps used to obtain them? I'm also a
little bit confused about how an inlined function can lead to a
smaller executable... or did you just mean lines-of-code?
Cheers,
Wincent
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Alex Riesen @ 2007-10-07 22:08 UTC (permalink / raw)
To: Elijah Newren; +Cc: git
In-Reply-To: <51419b2c0710071423y1b194f22gb6ccaa57303029d1@mail.gmail.com>
Elijah Newren, Sun, Oct 07, 2007 23:23:59 +0200:
> # Try to recompress and clean up, then check the new size
> git gc --aggressive --prune
> du -ks . # 10580K !?!?!?
> du -ks .git # 10564K
git-filter-branch makes a backup of your original references:
$ git filter-branch --help
...
Always verify that the rewritten version is correct: The original refs,
if different from the rewritten ones, will be stored in the namespace
refs/original/.
...
These will keep your big files in repository.
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Elijah Newren @ 2007-10-07 22:00 UTC (permalink / raw)
To: Frank Lichtenheld; +Cc: git
In-Reply-To: <20071007213817.GJ31659@planck.djpig.de>
On 10/7/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:
> On Sun, Oct 07, 2007 at 03:23:59PM -0600, Elijah Newren wrote:
> > The following set of instructions will duplicate my problem with a
> > smaller repo; why is the local git repository bigger after running
> > git-filter-branch rather than smaller as I'd expect? I'm probably
> > missing something obvious, but I have no idea what it is.
>
> The usual suspect would be the reflog.
The git-filter-branch documentation mentions creating refs/original
under .git. Unfortunately, it doesn't contain any links or
documentation on how I'd clean those out and I haven't been able to
figure it out. I asked on #git how to clean these out and got some
answers that didn't work (git branch -d and something else I don't
remember). So...how do I fix the reflog, and then repack to have a
pack under 11MB in size?
Thanks,
Elijah
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Alex Riesen @ 2007-10-07 21:57 UTC (permalink / raw)
To: David Kastrup; +Cc: git
In-Reply-To: <851wc6lwkc.fsf@lola.goethe.zz>
David Kastrup, Sun, Oct 07, 2007 18:27:15 +0200:
> Alex Riesen <raa.lkml@gmail.com> writes:
> >> > +static inline int strbuf_cmp(const struct strbuf *a, const struct strbuf *b)
> >> > +{
> >> > + int len = a->len < b->len ? a->len: b->len;
> >> > + int cmp = memcmp(a->buf, b->buf, len);
> >> > + if (cmp)
> >> > + return cmp;
> >> > + return a->len < b->len ? -1: a->len != b->len;
> >> > +}
> >>
> >> My guess is that you are conflating two issues about speed here: the
> >> inlining will like speed the stuff up. But having to evaluate the
> >> (a->len < b->len) comparison twice will likely slow it down.
> >
> > Can't the result of the expression be reused in compiled?
> > Isn't it a common expression?
>
> No, since the call to memcmp might change a->len or b->len. A
Huh?! How's that? It is not even given them!
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Alex Riesen @ 2007-10-07 21:54 UTC (permalink / raw)
To: David Kastrup
Cc: Miles Bader, Pierre Habouzit, Timo Hirvonen, git, Junio C Hamano
In-Reply-To: <857ilylxhm.fsf@lola.goethe.zz>
David Kastrup, Sun, Oct 07, 2007 18:07:17 +0200:
> Miles Bader <miles@gnu.org> writes:
>
> > Pierre Habouzit <madcoder@debian.org> writes:
> >>> strbuf->buf is always non-NULL and NUL-terminated so you could just do
> >>>
> >>> static inline int strbuf_cmp(const struct strbuf *a, const struct strbuf *b)
> >>> {
> >>> int len = a->len < b->len ? a->len : b->len;
> >>> return memcmp(a->buf, b->buf, len + 1);
> >>> }
> >>
> >> doesn't work, because a buffer can have (in some very specific cases)
> >> an embeded NUL.
> >
> > Couldn't you then just do:
> >
> > int len = a->len < b->len ? a->len : b->len;
> > int cmp = memcmp(a->buf, b->buf, len);
> > if (cmp == 0)
> > cmp = b->len - a->len;
> > return cmp;
> >
> > [In the case where one string is a prefix of the other, then the longer
> > one is "greater".]
> >
> > ?
>
> I fail to see where this variant is simpler than what we started the
> journey of simplification from.
>
> The only change I consider worth checking from the whole series in
> this thread is making the function inline.
It also makes arguments const (which admittedly wont make it faster).
> ... All the rest pretty much
> was worse than what we started from in that it needed to reevaluate
> more conditions and turned out more complicated and obfuscate even to
> the human reader.
it _is_ smaller. And it is _measurably_ faster on that thing I have at
home (and old p4).
^ permalink raw reply
* Re: [PATCH 1/2] Have a filter_start/filter_end API.
From: Alex Riesen @ 2007-10-07 21:50 UTC (permalink / raw)
To: Pierre Habouzit, Linus Torvalds, Junio C Hamano, git
In-Reply-To: <20071007165218.GE10024@artemis.corp>
Pierre Habouzit, Sun, Oct 07, 2007 18:52:18 +0200:
> So, maybe there is a way to rename strbuf_start_filter so that it's
> more straightforward. The way to use the API is:
>
> @ char *to_free = NULL;
> @ if ((src is inside dst && need_realloc) || operation is not in-place)
> @ to_free = strbuf_detach(dst, NULL);
> @ strbuf_make_room(dst, needed_size);
Why do you have to play these games with src being inside/outside?
Don't you know where src already is? AFAICS in convert.c crlf_to_git -
you do. And everywhere else you know this fact too.
> // do whatever you want with src and dst
>
> free(to_free);
>
> strbuf_start_filter tries to implement the block marked with `@'. Of
> course:
> * need_realloc == (needed_size >= dst->alloc)
> * src is inside dst means:
> src > dst->buf && src < dst->buf + dst->alloc
in convert.c it is never "inside". It is _exactly_ the ->buf.
No need for generic "inside" check. Just test if src == ->buf.
And AFAICS, there is no other users of the function.
> Though, those are both things that I find ugly to "know" in convert.c.
> How things are allocated in strbufs is one of the few things we don't
> want to assume anywhere outside of the strbuf module.
src is outside of strbuf scope. It is not internal to struct strbuf.
The caller must already know if it is inside of the given strbuf
instance.
need_realloc is covered by make_room, isn't it?
I'd suggest just fix the caller, it is simple in convert.c: just use
ret, which contains exactly this information. If you insist on editing
in-place, which makes your routines really need the in-placeability
informaion. Just give it to them, better explicitely. All of this
makes the routines very convert.c specific, which is the reason why I
argument to have them just there and nowhere else.
Alternatively, one can memdup ->buf (as it is the input for next
filter) every time a filter modifies it (which is safe, but simple,
slow, requires memory, and may fragment heap):
/* simplified */
int convert_to_git(const char *path, const char *src, size_t len, struct strbuf *dst)
{
int crlf = CRLF_GUESS;
int ident = 0, ret = 0;
char *filter = NULL;
const char *tmp = src;
ret |= apply_filter(path, tmp, len, dst, filter);
if (ret) {
tmp = xmemdupz(dst->buf, dst->len);
len = dst->len;
}
if (crlf_to_git(path, tmp, len, dst, crlf)) {
ret |= 1;
if (tmp != src)
free((void*)tmp);
tmp = xmemdupz(dst->buf, dst->len);
len = dst->len;
}
ret |= ident_to_git(path, tmp, len, dst, ident);
if (tmp != src)
free((void*)tmp);
return ret;
}
It is just to show that nothing like strbuf_start_filter is _needed_
at all.
^ permalink raw reply
* Re: git fetch -- double fetch
From: Andy Whitcroft @ 2007-10-07 21:44 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710071728570.4174@racer.site>
On Sun, Oct 07, 2007 at 05:29:38PM +0100, Johannes Schindelin wrote:
> Hi,
>
> On Sat, 6 Oct 2007, Andy Whitcroft wrote:
>
> > I have recently been seeing repeated fetching of some branches. I feel
> > this has happened in at least three of my repos on three distinct
> > projects:
> >
> > apw@pinky$ git fetch origin
> > remote: Generating pack...
> > remote: Done counting 5 objects.
> > remote: Deltifying 5 objects...
> > remote: 100% (5/5) done
> > Unpacking 5 objects...
> > remote: Total 5 (delta 0), reused 0 (delta 0)
> > 100% (5/5) done
> > * refs/remotes/origin/master: fast forward to branch 'master' of ssh://git@abat-dev/var/www/git/abat
> > old..new: ce046f0..41c9dde
> > * refs/remotes/origin/master: fast forward to branch 'master' of ssh://git@abat-dev/var/www/git/abat
> > old..new: ce046f0..41c9dde
>
> What does "git config --get-all remote.origin.fetch" say?
apw@pinky$ git config --get-all remote.origin.fetch
+refs/heads/master:refs/remotes/origin/master
+refs/heads/*:refs/remotes/origin/*
apw@pinky$
I don't think that I did anything to this config, I think that is what
the clone setup for me.
-apw
^ permalink raw reply
* Re: [PATCH] git-svn: respect Subversion's [auth] section configuration values
From: Eric Wong @ 2007-10-07 21:43 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: Sam Vilain, git
In-Reply-To: <20071007101437.GB3943@void.codelabs.ru>
Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> Eric, Sam, good day.
> Sun, Oct 07, 2007 at 02:24:43PM +1300, Sam Vilain wrote:
> > Eygene Ryabinkin wrote:
> > > Parameters 'store-passwords' and 'store-auth-creds' from Subversion's
> > > configuration (~/.subversion/config) were not respected. This was
> > > fixed: the default values for these parameters are set to 'yes' to
> > > follow Subversion behaviour.
> > >
> >
> > I saw this in the svn api before. It really is a strange API, requiring
> > the user to get things like this right.
>
> Yes, the need to parse the configuration and set some flags is
> rather strange. Looks like nobody cared to stuff the code like
> I had added to the configuration file parsing routines.
I think I started to look at it a while back and forgot about it :)
> > You can use no warnings 'once';
>
> Great, thanks for the pointer! Eric, do you want me to produce
> another patch or you'll correct mine?
Go ahead and produce another patch. I haven't had much time to
work on git lately.
--
Eric Wong
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox