Support for command aliases
cover Support for command aliases
Hi,
These patches add support for StGit command aliases via stgit.alias.<cmd> config options. They also re-add previously removed commands (add, rm, resolved) and a new one (mv).
stg help lists the present aliases.
Catalin Marinas (3):
Populate the cached config options with the defaults Add support for command aliases
Replace some git commands with stg aliases in test scripts
stgit/commands/__init__.py | 3 ++- stgit/config.py | 37 +++++++++++++++++++++++-------------- stgit/main.py | 35 ++++++++++++++++++++++++++++++++++- t/t0001-subdir-branches.sh | 2 +- t/t0002-status.sh | 12 ++++++------ t/t1000-branch-create.sh | 4 ++-- t/t1002-branch-clone.sh | 2 +- t/t1200-push-modified.sh | 2 +- t/t1201-pull-trailing.sh | 2 +- t/t1202-push-undo.sh | 6 +++--- t/t1203-push-conflict.sh | 6 +++--- t/t1204-pop-keep.sh | 2 +- t/t1205-push-subdir.sh | 6 +++--- t/t1206-push-hidden.sh | 2 +- t/t1207-push-tree.sh | 2 +- t/t1300-uncommit.sh | 4 ++-- t/t1301-repair.sh | 8 ++++---- t/t1302-repair-interop.sh | 2 +- t/t1500-float.sh | 14 +++++++------- t/t1501-sink.sh | 12 ++++++------ t/t1600-delete-one.sh | 12 ++++++------ t/t1601-delete-many.sh | 2 +- t/t1602-delete-spill.sh | 2 +- t/t1700-goto-top.sh | 2 +- t/t1701-goto-hidden.sh | 2 +- t/t1800-import.sh | 4 ++-- t/t1900-mail.sh | 2 +- t/t2000-sync.sh | 12 ++++++------ t/t2100-pull-policy-fetch.sh | 4 ++-- t/t2101-pull-policy-pull.sh | 6 +++--- t/t2102-pull-policy-rebase.sh | 4 ++-- t/t2200-rebase.sh | 4 ++-- t/t2300-refresh-subdir.sh | 4 ++-- t/t2400-diff.sh | 2 +- t/t2500-clean.sh | 2 +- t/t2600-squash.sh | 2 +- t/t2700-refresh.sh | 6 +++--- t/t2701-refresh-p.sh | 4 ++-- t/t2702-refresh-rm.sh | 10 +++++----- t/t2800-goto-subdir.sh | 2 +- t/t3000-dirty-merge.sh | 2 +- t/t3100-reset.sh | 2 +- t/t3101-reset-hard.sh | 2 +- t/t3102-undo.sh | 2 +- t/t3103-undo-hard.sh | 2 +- t/t3104-redo.sh | 2 +- t/t3105-undo-external-mod.sh | 6 +++--- t/t3200-non-ascii-filenames.sh | 4 ++-- t/t3300-edit.sh | 2 +- t/t3400-pick.sh | 8 ++++---- t/t4100-publish.sh | 12 ++++++------ 51 files changed, 169 insertions(+), 126 deletions(-)
Signature · 1 line
Catalin
PATCH 1/3 Populate the cached config options with the defaults
The patch pre-populates the cached config options with the default values. It also removes an unused option (stgit.extensions).
--- stgit/config.py | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
stgit/config.py +14 -14
@@ -28,16 +28,15 @@ class GitConfigException(StgException): class GitConfig: __defaults={ - 'stgit.smtpserver': 'localhost:25', - 'stgit.smtpdelay': '5', - 'stgit.pullcmd': 'git pull', - 'stgit.fetchcmd': 'git fetch', - 'stgit.pull-policy': 'pull', - 'stgit.autoimerge': 'no', - 'stgit.keepoptimized': 'no', - 'stgit.extensions': '.ancestor .current .patched', - 'stgit.shortnr': '5', - 'stgit.pager': 'less' + 'stgit.smtpserver': ['localhost:25'], + 'stgit.smtpdelay': ['5'], + 'stgit.pullcmd': ['git pull'], + 'stgit.fetchcmd': ['git fetch'], + 'stgit.pull-policy': ['pull'], + 'stgit.autoimerge': ['no'], + 'stgit.keepoptimized': ['no'], + 'stgit.shortnr': ['5'], + 'stgit.pager': ['less'] } __cache = None
@@ -47,7 +46,7 @@ class GitConfig: done already.""" if self.__cache is not None: return - self.__cache = {} + self.__cache = self.__defaults lines = Run('git', 'config', '--null', '--list' ).discard_exitcode().raw_output() for line in filter(None, lines.split('\0')):
@@ -56,9 +55,10 @@ class GitConfig: def get(self, name): self.load() - if name not in self.__cache: - self.__cache[name] = [self.__defaults.get(name, None)] - return self.__cache[name][-1] + try: + return self.__cache[name][-1] + except KeyError: + return None def getall(self, name): self.load()
Re: [StGit PATCH 1/3] Populate the cached config options with the defaults
Hmm. What's the point of this rewrite?
Quoted 4 lines · Catalin Marinas
+ try:
+ return self.__cache[name][-1]
+ except KeyError:
+ return None
You could write this as
return self.__cache.get(name, [None])[-1]
Signature · 3 lines
Karl Wiberg, [email protected] subrabbit.wordpress.com www.treskal.com/kalle
Re: [StGit PATCH 1/3] Populate the cached config options with the defaults
Quoted 1 line · Karl Wiberg
Hmm. What's the point of this rewrite?
Ah, never mind, patch 2/3 made it clear. Though it would have been nice to read about it in the commit message. ;-)
Signature · 3 lines
Karl Wiberg, [email protected] subrabbit.wordpress.com www.treskal.com/kalle
PATCH 2/3 Add support for command aliases
In reply to Catalin MarinasThis patch introduces support StGit command aliases with a few defaults:
stg add -> git add
stg rm -> git rm
stg mv -> git mv
stg resolved -> git add
--- stgit/commands/__init__.py | 3 ++- stgit/config.py | 11 ++++++++++- stgit/main.py | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-)
stgit/commands/__init__.py +2 -1
@@ -28,7 +28,8 @@ def get_command(mod): _kinds = [('repo', 'Repository commands'), ('stack', 'Stack (branch) commands'), ('patch', 'Patch commands'), - ('wc', 'Index/worktree commands')] + ('wc', 'Index/worktree commands'), + ('alias', 'Alias commands')] _kind_order = [kind for kind, desc in _kinds] _kinds = dict(_kinds)
stgit/config.py +10 -1
@@ -36,7 +36,11 @@ class GitConfig: 'stgit.autoimerge': ['no'], 'stgit.keepoptimized': ['no'], 'stgit.shortnr': ['5'], - 'stgit.pager': ['less'] + 'stgit.pager': ['less'], + 'stgit.alias.add': ['git add'], + 'stgit.alias.rm': ['git rm'], + 'stgit.alias.mv': ['git mv'], + 'stgit.alias.resolved': ['git add'] } __cache = None
@@ -76,6 +80,11 @@ class GitConfig: else: raise GitConfigException, 'Value for "%s" is not an integer: "%s"' % (name, value) + def getstartswith(self, name): + self.load() + return ((n, v[-1]) for (n, v) in self.__cache.iteritems() + if n.startswith(name)) + def rename_section(self, from_name, to_name): """Rename a section in the config file. Silently do nothing if the section doesn't exist."""
stgit/main.py +34 -1
@@ -23,6 +23,30 @@ import sys, os, traceback import stgit.commands from stgit.out import * from stgit import argparse, run, utils +from stgit.config import config + +class CommandAlias(object): + def __init__(self, name, command): + self.__command = command + self.__name__ = name + self.usage = ['<arguments>'] + self.help = 'Alias for "%s <arguments>".' % self.__command + self.options = [] + + def func(self, args): + cmd = self.__command.split() + args + p = run.Run(*cmd) + p.discard_exitcode().run() + return p.exitcode + +def is_cmd_alias(cmd): + return isinstance(cmd, CommandAlias) + +def append_alias_commands(cmd_list): + for (name, command) in config.getstartswith('stgit.alias.'): + name = utils.strip_prefix('stgit.alias.', name) + cmd_list[name] = (CommandAlias(name, command), + 'Alias commands', command) # # The commands map
@@ -49,9 +73,13 @@ class Commands(dict): def __getitem__(self, key): cmd_mod = self.get(key) or self.get(self.canonical_cmd(key)) - return stgit.commands.get_command(cmd_mod) + if is_cmd_alias(cmd_mod): + return cmd_mod + else: + return stgit.commands.get_command(cmd_mod) cmd_list = stgit.commands.get_commands() +append_alias_commands(cmd_list) commands = Commands((cmd, mod) for cmd, (mod, kind, help) in cmd_list.iteritems())
@@ -100,6 +128,8 @@ def _main(): sys.argv[0] += ' %s' % cmd command = commands[cmd] parser = argparse.make_option_parser(command) + if is_cmd_alias(command): + parser.remove_option('-h') from pydoc import pager pager(parser.format_help()) else:
@@ -121,6 +151,9 @@ def _main(): del(sys.argv[1]) command = commands[cmd] + if is_cmd_alias(command): + sys.exit(command.func(sys.argv[1:])) + parser = argparse.make_option_parser(command) options, args = parser.parse_args() directory = command.directory
PATCH 3/3 Replace some git commands with stg aliases in test scripts
In reply to Catalin Marinas--- t/t0001-subdir-branches.sh | 2 +- t/t0002-status.sh | 12 ++++++------ t/t1000-branch-create.sh | 4 ++-- t/t1002-branch-clone.sh | 2 +- t/t1200-push-modified.sh | 2 +- t/t1201-pull-trailing.sh | 2 +- t/t1202-push-undo.sh | 6 +++--- t/t1203-push-conflict.sh | 6 +++--- t/t1204-pop-keep.sh | 2 +- t/t1205-push-subdir.sh | 6 +++--- t/t1206-push-hidden.sh | 2 +- t/t1207-push-tree.sh | 2 +- t/t1300-uncommit.sh | 4 ++-- t/t1301-repair.sh | 8 ++++---- t/t1302-repair-interop.sh | 2 +- t/t1500-float.sh | 14 +++++++------- t/t1501-sink.sh | 12 ++++++------ t/t1600-delete-one.sh | 12 ++++++------ t/t1601-delete-many.sh | 2 +- t/t1602-delete-spill.sh | 2 +- t/t1700-goto-top.sh | 2 +- t/t1701-goto-hidden.sh | 2 +- t/t1800-import.sh | 4 ++-- t/t1900-mail.sh | 2 +- t/t2000-sync.sh | 12 ++++++------ t/t2100-pull-policy-fetch.sh | 4 ++-- t/t2101-pull-policy-pull.sh | 6 +++--- t/t2102-pull-policy-rebase.sh | 4 ++-- t/t2200-rebase.sh | 4 ++-- t/t2300-refresh-subdir.sh | 4 ++-- t/t2400-diff.sh | 2 +- t/t2500-clean.sh | 2 +- t/t2600-squash.sh | 2 +- t/t2700-refresh.sh | 6 +++--- t/t2701-refresh-p.sh | 4 ++-- t/t2702-refresh-rm.sh | 10 +++++----- t/t2800-goto-subdir.sh | 2 +- t/t3000-dirty-merge.sh | 2 +- t/t3100-reset.sh | 2 +- t/t3101-reset-hard.sh | 2 +- t/t3102-undo.sh | 2 +- t/t3103-undo-hard.sh | 2 +- t/t3104-redo.sh | 2 +- t/t3105-undo-external-mod.sh | 6 +++--- t/t3200-non-ascii-filenames.sh | 4 ++-- t/t3300-edit.sh | 2 +- t/t3400-pick.sh | 8 ++++---- t/t4100-publish.sh | 12 ++++++------ 48 files changed, 110 insertions(+), 110 deletions(-)
t/t0001-subdir-branches.sh +1 -1
@@ -14,7 +14,7 @@ containing slashes (that is, branches living in a subdirectory of test_expect_success 'Create a patch' \ 'stg init && echo "foo" > foo.txt && - git add foo.txt && + stg add foo.txt && stg new foo -m "Add foo.txt" && stg refresh'
t/t0002-status.sh +6 -6
@@ -54,7 +54,7 @@ cat > expected.txt <<EOF A foo/bar EOF test_expect_success 'Status with an added file' ' - git add foo && + stg add foo && stg status > output.txt && test_cmp expected.txt output.txt '
@@ -95,7 +95,7 @@ test_expect_success 'Status after refresh' ' test_expect_success 'Add another file' ' echo lajbans > fie && - git add fie && + stg add fie && stg refresh '
@@ -145,7 +145,7 @@ A fie M foo/bar EOF test_expect_success 'Status after resolving the push' ' - git add --update && + stg add --update && stg status > output.txt && test_cmp expected.txt output.txt '
@@ -166,7 +166,7 @@ EOF test_expect_success 'Status of disappeared newborn' ' stg refresh && touch foo/bar && - git add foo/bar && + stg add foo/bar && rm foo/bar && stg status > output.txt && test_cmp expected.txt output.txt
@@ -177,8 +177,8 @@ A fay D fie EOF test_expect_success 'Status after renaming a file' ' - git rm foo/bar && - git mv fie fay && + stg rm foo/bar && + stg mv fie fay && stg status > output.txt && test_cmp expected.txt output.txt '
t/t1000-branch-create.sh +2 -2
@@ -78,9 +78,9 @@ test_expect_success \ 'Setup two commits including removal of generated files' ' git init && touch file1 file2 && - git add file1 file2 && + stg add file1 file2 && git commit -m 1 && - git rm file1 file2 && + stg rm file1 file2 && git commit -m 2 && touch file2 '
t/t1002-branch-clone.sh +1 -1
@@ -14,7 +14,7 @@ test_expect_success \ 'Create a GIT commit' \ ' echo bar > bar.txt && - git add bar.txt && + stg add bar.txt && git commit -a -m bar '
t/t1200-push-modified.sh +1 -1
@@ -23,7 +23,7 @@ test_expect_success \ stg clone foo bar && ( cd bar && stg new p1 -m p1 && - printf "a\nc\n" > file && git add file && stg refresh && + printf "a\nc\n" > file && stg add file && stg refresh && stg new p2 -m p2 && printf "a\nb\nc\n" > file && stg refresh && [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
t/t1201-pull-trailing.sh +1 -1
@@ -18,7 +18,7 @@ test_create_repo foo test_expect_success \ 'Setup and clone tree, and setup changes' \ "(cd foo && - printf 'a\nb\n' > file && git add file && git commit -m . + printf 'a\nb\n' > file && stg add file && git commit -m . ) && stg clone foo bar && (cd bar && stg new p1 -m p1
t/t1202-push-undo.sh +3 -3
@@ -21,7 +21,7 @@ test_expect_success \ ' stg new foo -m foo && echo foo > test && - git add test && + stg add test && stg refresh '
@@ -30,7 +30,7 @@ test_expect_success \ ' stg new bar -m bar && echo bar > test && - git add test && + stg add test && stg refresh '
@@ -62,7 +62,7 @@ test_expect_success \ 'Undo with disappeared newborn' \ ' touch newfile && - git add newfile && + stg add newfile && rm newfile && stg undo --hard '
t/t1203-push-conflict.sh +3 -3
@@ -21,7 +21,7 @@ test_expect_success \ stg new foo -m foo && echo foo > test && echo fie > test2 && - git add test test2 && + stg add test test2 && stg refresh && stg pop '
@@ -31,7 +31,7 @@ test_expect_success \ ' stg new bar -m bar && echo bar > test && - git add test && + stg add test && stg refresh '
@@ -63,7 +63,7 @@ test_expect_success \ 'Resolve the conflict' \ ' echo resolved > test && - git add test && + stg resolved test && stg refresh '
t/t1204-pop-keep.sh +1 -1
@@ -8,7 +8,7 @@ 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 && - git add patch$i.txt && + stg add patch$i.txt && stg refresh done && [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
t/t1205-push-subdir.sh +3 -3
@@ -9,7 +9,7 @@ test_expect_success 'Create some patches' ' stg new p$i -m p$i && echo x$i >> x.txt && echo y$i >> foo/y.txt && - git add x.txt foo/y.txt && + stg add x.txt foo/y.txt && stg refresh done && [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
@@ -33,7 +33,7 @@ test_expect_success 'Modifying push from a subdir' ' [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] && stg new extra -m extra && echo extra >> extra.txt && - git add extra.txt && + stg add extra.txt && stg refresh && cd foo && stg push &&
@@ -57,7 +57,7 @@ test_expect_success 'Conflicting add/unknown file in subdir' ' stg new foo -m foo && mkdir d && echo foo > d/test && - git add d/test && + stg add d/test && stg refresh && stg pop && mkdir -p d &&
t/t1206-push-hidden.sh +1 -1
@@ -7,7 +7,7 @@ test_description='Test "stg push" with hidden patches' test_expect_success 'Initialize StGit stack' ' stg init && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg new -m hidden-patch && stg refresh && stg pop &&
t/t1207-push-tree.sh +1 -1
@@ -12,7 +12,7 @@ test_expect_success \ stg init && stg new A -m A && echo hello world > a && - git add a && + stg add a && stg refresh stg new B -m B && echo HELLO WORLD > a &&
t/t1300-uncommit.sh +2 -2
@@ -19,7 +19,7 @@ test_expect_success \ ' stg new foo -m "Foo Patch" && echo foo > test && - git add test && + stg add test && stg refresh '
@@ -28,7 +28,7 @@ test_expect_success \ ' stg new bar -m "Bar Patch" && echo bar > test && - git add test && + stg add test && stg refresh '
t/t1301-repair.sh +4 -4
@@ -20,7 +20,7 @@ test_expect_success \ ' stg new foo -m foo && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh '
@@ -32,7 +32,7 @@ test_expect_success \ 'Create a GIT commit' \ ' echo bar > bar.txt && - git add bar.txt && + stg add bar.txt && git commit -a -m bar '
@@ -46,7 +46,7 @@ test_expect_success \ 'Create three more GIT commits' \ ' echo one > numbers.txt && - git add numbers.txt && + stg add numbers.txt && git commit -a -m one && echo two >> numbers.txt && git commit -a -m two &&
@@ -65,7 +65,7 @@ test_expect_success \ ' git checkout -b br master^^ && echo woof > woof.txt && - git add woof.txt && + stg add woof.txt && git commit -a -m woof && git checkout master && git pull . br
t/t1302-repair-interop.sh +1 -1
@@ -4,7 +4,7 @@ test_description='Test git/StGit interoperability with "stg repair"' test_expect_success 'Create some git-only history' ' echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && git commit -a -m foo && git tag foo-tag && for i in 0 1 2 3 4; do
t/t1500-float.sh +7 -7
@@ -12,13 +12,13 @@ test_description='Test floating a number of patches to the top of the stack test_expect_success \ 'Initialize the StGIT repository' \ 'stg init && - stg new A -m "a" && echo A >a.txt && git add a.txt && stg refresh && - stg new B -m "b" && echo B >b.txt && git add b.txt && stg refresh && - stg new C -m "c" && echo C >c.txt && git add c.txt && stg refresh && - stg new D -m "d" && echo D >d.txt && git add d.txt && stg refresh && - stg new E -m "e" && echo E >e.txt && git add e.txt && stg refresh && - stg new F -m "f" && echo F >f.txt && git add f.txt && stg refresh && - stg new G -m "g" && echo G >g.txt && git add g.txt && stg refresh && + stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh && + stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh && + stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh && + stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh && + stg new E -m "e" && echo E >e.txt && stg add e.txt && stg refresh && + stg new F -m "f" && echo F >f.txt && stg add f.txt && stg refresh && + stg new G -m "g" && echo G >g.txt && stg add g.txt && stg refresh && stg pop && test "$(echo $(stg series --applied --noprefix))" = "A B C D E F" '
t/t1501-sink.sh +6 -6
@@ -6,22 +6,22 @@ test_description='Test "stg sink"' test_expect_success 'Initialize StGit stack' ' echo 0 >> f0 && - git add f0 && + stg add f0 && git commit -m initial && echo 1 >> f1 && - git add f1 && + stg add f1 && git commit -m p1 && echo 2 >> f2 && - git add f2 && + stg add f2 && git commit -m p2 && echo 3 >> f3 && - git add f3 && + stg add f3 && git commit -m p3 && echo 4 >> f4 && - git add f4 && + stg add f4 && git commit -m p4 && echo 22 >> f2 && - git add f2 && + stg add f2 && git commit -m p22 && stg init && stg uncommit p22 p4 p3 p2 p1 &&
t/t1600-delete-one.sh +6 -6
@@ -12,7 +12,7 @@ test_expect_success \ ' stg new foo -m foo && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh '
@@ -47,7 +47,7 @@ test_expect_success \ ' stg new foo -m foo && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh && stg pop '
@@ -65,11 +65,11 @@ test_expect_success \ ' stg new foo -m foo && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh && stg new bar -m bar && echo bar > bar.txt && - git add bar.txt && + stg add bar.txt && stg refresh '
@@ -87,12 +87,12 @@ test_expect_success \ stg branch --create br && stg new baz -m baz && echo baz > baz.txt && - git add baz.txt && + stg add baz.txt && stg refresh && stg branch master && stg new baz -m baz && echo baz > baz.txt && - git add baz.txt && + stg add baz.txt && stg refresh '
t/t1601-delete-many.sh +1 -1
@@ -12,7 +12,7 @@ test_expect_success \ ' stg new p0 -m p0 && echo p0 > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh && for i in 1 2 3 4 5 6 7 8 9; do stg new p$i -m p$i &&
t/t1602-delete-spill.sh +1 -1
@@ -9,7 +9,7 @@ test_expect_success 'Initialize the StGIT repository' ' test_expect_success 'Create five applied and three unapplied patches' ' for i in 0 1 2 3 4 5 6 7; do echo $i >> foo && - git add foo && + stg add foo && git commit -m p$i done stg uncommit -n 8 &&
t/t1700-goto-top.sh +1 -1
@@ -19,7 +19,7 @@ test_expect_success \ ' stg new foo -m "Foo Patch" && echo foo > test && - git add test && + stg add test && stg refresh '
t/t1701-goto-hidden.sh +1 -1
@@ -7,7 +7,7 @@ test_description='Test "stg goto" with hidden patches' test_expect_success 'Initialize StGit stack' ' stg init && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg new -m hidden-patch && stg refresh && stg pop &&
t/t1800-import.sh +2 -2
@@ -7,7 +7,7 @@ test_expect_success \ 'Initialize the StGIT repository' \ ' cp ../t1800-import/foo.txt . && - git add foo.txt && + stg add foo.txt && git commit -a -m "initial version" && stg init '
@@ -164,7 +164,7 @@ test_expect_success \ 'apply a series from a tarball' \ ' rm -f jabberwocky.txt && touch jabberwocky.txt && - git add jabberwocky.txt && git commit -m "empty file" jabberwocky.txt && + stg add jabberwocky.txt && git commit -m "empty file" jabberwocky.txt && (cd ../t1800-import; tar -cjf jabberwocky.tar.bz2 patches) && stg import --series ../t1800-import/jabberwocky.tar.bz2 [ $(git cat-file -p $(stg id) \
t/t1900-mail.sh +1 -1
@@ -10,7 +10,7 @@ test_expect_success \ for i in 1 2 3 4 5; do touch foo.txt && echo "line $i" >> foo.txt && - git add foo.txt && + stg add foo.txt && git commit -a -m "Patch $i" done && stg init &&
t/t2000-sync.sh +6 -6
@@ -18,15 +18,15 @@ test_expect_success \ ' stg new p1 -m p1 && echo foo1 > foo1.txt && - git add foo1.txt && + stg add foo1.txt && stg refresh && stg new p2 -m p2 && echo foo2 > foo2.txt && - git add foo2.txt && + stg add foo2.txt && stg refresh && stg new p3 -m p3 && echo foo3 > foo3.txt && - git add foo3.txt && + stg add foo3.txt && stg refresh && stg export && stg pop &&
@@ -86,7 +86,7 @@ test_expect_success \ stg refresh && stg goto p2 && echo bar2 > bar2.txt && - git add bar2.txt && + stg add bar2.txt && stg refresh && stg goto p3 && echo bar3 >> foo3.txt &&
@@ -117,7 +117,7 @@ test_expect_success \ ' [ "$(echo $(stg series --applied --noprefix))" = "p1" ] && [ "$(echo $(stg series --unapplied --noprefix))" = "p2 p3" ] && - git add --update && + stg add --update && stg refresh && stg goto p3 [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
@@ -135,7 +135,7 @@ test_expect_success \ ' [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] && [ "$(echo $(stg series --unapplied --noprefix))" = "" ] && - git add --update && + stg add --update && stg refresh && [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] && [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
t/t2100-pull-policy-fetch.sh +2 -2
@@ -22,7 +22,7 @@ test_expect_success \ git config branch.master.stgit.pull-policy fetch-rebase && git config --list && stg new c1 -m c1 && - echo a > file && git add file && stg refresh + echo a > file && stg add file && stg refresh ) '
@@ -30,7 +30,7 @@ test_expect_success \ 'Add non-rewinding commit upstream and pull it from clone' \ ' (cd upstream && stg new u1 -m u1 && - echo a > file2 && git add file2 && stg refresh) && + echo a > file2 && stg add file2 && stg refresh) && (cd clone && stg pull) && test -e clone/file2 '
t/t2101-pull-policy-pull.sh +3 -3
@@ -22,7 +22,7 @@ test_expect_success \ git config branch.master.stgit.pull-policy pull && git config --list && stg new c1 -m c1 && - echo a > file && git add file && stg refresh + echo a > file && stg add file && stg refresh ) '
@@ -30,7 +30,7 @@ test_expect_success \ 'Add non-rewinding commit upstream and pull it from clone' \ ' (cd upstream && stg new u1 -m u1 && - echo a > file2 && git add file2 && stg refresh) && + echo a > file2 && stg add file2 && stg refresh) && (cd clone && stg pull) && test -e clone/file2 '
@@ -49,7 +49,7 @@ test_expect_success \ test_expect_success \ '"Solve" the conflict (pretend there is none)' \ '(cd clone && - git add file2 && EDITOR=cat git commit)' + stg add file2 && EDITOR=cat git commit)' test_expect_success \ 'Push the stack back' \
t/t2102-pull-policy-rebase.sh +2 -2
@@ -16,14 +16,14 @@ test_expect_success \ git config branch.stack.stgit.pull-policy rebase && git config --list && stg new c1 -m c1 && - echo a > file && git add file && stg refresh + echo a > file && stg add file && stg refresh ' test_expect_success \ 'Add non-rewinding commit in parent and pull the stack' \ ' stg branch parent && stg new u1 -m u1 && - echo b > file2 && git add file2 && stg refresh && + echo b > file2 && stg add file2 && stg refresh && stg branch stack && stg pull && test -e file2 '
t/t2200-rebase.sh +2 -2
@@ -11,10 +11,10 @@ test_expect_success \ 'Setup a multi-commit branch and fork an stgit stack' \ ' echo foo > file1 && - git add file1 && + stg add file1 && git commit -m a && echo foo > file2 && - git add file2 && + stg add file2 && git commit -m b && stg branch --create stack &&
t/t2300-refresh-subdir.sh +2 -2
@@ -8,7 +8,7 @@ test_expect_success 'Refresh from a subdirectory' ' echo foo >> foo.txt && mkdir bar && echo bar >> bar/bar.txt && - git add foo.txt bar/bar.txt && + stg add foo.txt bar/bar.txt && cd bar && stg refresh && cd .. &&
@@ -48,7 +48,7 @@ test_expect_success 'Refresh subdirectories recursively' ' test_expect_success 'refresh -u' ' echo baz >> bar/baz.txt && stg new p1 -m p1 && - git add bar/baz.txt && + stg add bar/baz.txt && stg refresh --index && echo xyzzy >> foo.txt && echo xyzzy >> bar/bar.txt &&
t/t2400-diff.sh +1 -1
@@ -10,7 +10,7 @@ test_expect_success 'Diff with no StGit data' ' test_expect_success 'Make some local changes' ' echo foo >> foo.txt && - git add foo.txt + stg add foo.txt ' test_expect_success 'Diff with some local changes' '
t/t2500-clean.sh +1 -1
@@ -9,7 +9,7 @@ test_expect_success 'Initialize StGit stack' ' stg new e0 -m e0 && stg new p0 -m p0 && echo foo > foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh && stg new e1 -m e1 && stg new e2 -m e2 &&
t/t2600-squash.sh +1 -1
@@ -9,7 +9,7 @@ test_expect_success 'Initialize StGit stack' ' for i in 0 1 2 3; do stg new p$i -m "foo $i" && echo "foo $i" >> foo.txt && - git add foo.txt && + stg add foo.txt && stg refresh done '
t/t2700-refresh.sh +3 -3
@@ -13,7 +13,7 @@ test_expect_success 'Initialize StGit stack' ' stg new p0 -m "base" && for i in 1 2 3; do echo base >> foo$i.txt && - git add foo$i.txt + stg add foo$i.txt done stg refresh && for i in 1 2 3; do
@@ -104,7 +104,7 @@ test_expect_success 'Refresh --index' ' stg status && stg new p4 -m "refresh_index" && echo baz 1 >> foo1.txt && - git add foo1.txt && + stg add foo1.txt && echo blah 1 >> foo1.txt && echo baz 2 >> foo2.txt && stg refresh --index &&
@@ -119,7 +119,7 @@ test_expect_success 'Refresh --index' ' ' test_expect_success 'Refresh moved files' ' - git mv foo1.txt foo1-new.txt && + stg mv foo1.txt foo1-new.txt && stg refresh '
t/t2701-refresh-p.sh +2 -2
@@ -15,7 +15,7 @@ test_expect_success 'Initialize StGit stack' ' stg init && for i in 1 2; do echo x > $i.txt && - git add $i.txt && + stg add $i.txt && stg new p$i -m "Patch $i" && stg refresh done
@@ -33,7 +33,7 @@ test_expect_success 'Add new file to non-top patch' ' stg status > status1.txt && test_cmp expected0.txt status1.txt && echo y > new.txt && - git add new.txt && + stg add new.txt && stg refresh -p p1 && stg status > status2.txt && test_cmp expected0.txt status2.txt &&
t/t2702-refresh-rm.sh +5 -5
@@ -20,7 +20,7 @@ test_expect_success 'Initialize StGit stack' ' stg init && echo x > x.txt && echo y > y.txt && - git add x.txt y.txt && + stg add x.txt y.txt && git commit -m "Add some files" '
@@ -28,9 +28,9 @@ cat > expected0.txt <<EOF D y.txt EOF printf '' > expected1.txt -test_expect_success 'git rm a file' ' +test_expect_success 'stg rm a file' ' stg new -m p0 && - git rm y.txt && + stg rm y.txt && stg status > status0.txt && test_cmp expected0.txt status0.txt && stg refresh &&
@@ -47,10 +47,10 @@ D y.txt M x.txt EOF printf '' > expected1.txt -test_expect_success 'git rm a file together with other changes' ' +test_expect_success 'stg rm a file together with other changes' ' stg new -m p1 && echo x2 >> x.txt && - git rm y.txt && + stg rm y.txt && stg status > status0.txt && test_cmp expected0.txt status0.txt && stg refresh &&
t/t2800-goto-subdir.sh +1 -1
@@ -13,7 +13,7 @@ test_expect_success 'Initialize StGit stack' ' for i in 1 2 3; do echo foo$i >> foo/bar && stg new p$i -m p$i && - git add foo/bar && + stg add foo/bar && stg refresh done '
t/t3000-dirty-merge.sh +1 -1
@@ -7,7 +7,7 @@ test_description='Try a push that requires merging a file that is dirty' test_expect_success 'Initialize StGit stack with two patches' ' stg init && touch a && - git add a && + stg add a && git commit -m a && echo 1 > a && git commit -a -m p1 &&
t/t3100-reset.sh +1 -1
@@ -12,7 +12,7 @@ EOF test_expect_success 'Initialize StGit stack with three patches' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m a && echo 111 >> a && git commit -a -m p1 &&
t/t3101-reset-hard.sh +1 -1
@@ -13,7 +13,7 @@ EOF test_expect_success 'Initialize StGit stack with three patches' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m a && echo 111 >> a && git commit -a -m p1 &&
t/t3102-undo.sh +1 -1
@@ -12,7 +12,7 @@ EOF test_expect_success 'Initialize StGit stack with three patches' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m a && echo 111 >> a && git commit -a -m p1 &&
t/t3103-undo-hard.sh +1 -1
@@ -13,7 +13,7 @@ EOF test_expect_success 'Initialize StGit stack with three patches' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m a && echo 111 >> a && git commit -a -m p1 &&
t/t3104-redo.sh +1 -1
@@ -12,7 +12,7 @@ EOF test_expect_success 'Initialize StGit stack with three patches' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m a && echo 111 >> a && git commit -a -m p1 &&
t/t3105-undo-external-mod.sh +3 -3
@@ -13,10 +13,10 @@ EOF test_expect_success 'Initialize StGit stack' ' stg init && echo 000 >> a && - git add a && + stg add a && git commit -m p0 && echo 111 >> a && - git add a && + stg add a && git commit -m p1 && stg uncommit -n 1 '
@@ -29,7 +29,7 @@ EOF test_expect_success 'Make a git commit and turn it into a patch' ' git rev-parse HEAD > head0.txt && echo 222 >> a && - git add a && + stg add a && git commit -m p2 && git rev-parse HEAD > head1.txt && stg repair &&
t/t3200-non-ascii-filenames.sh +2 -2
@@ -11,11 +11,11 @@ EOF test_expect_success 'Setup' ' echo "Fjäderholmarna" > skärgårdsö.txt && - git add skärgårdsö.txt && + stg add skärgårdsö.txt && git commit -m "Create island" && stg init && echo foo > unrelated.txt && - git add unrelated.txt && + stg add unrelated.txt && stg new p0 -m "Unrelated file" && stg refresh && stg pop &&
t/t3300-edit.sh +1 -1
@@ -5,7 +5,7 @@ test_description='Test "stg edit"' test_expect_success 'Setup' ' printf "000\n111\n222\n333\n" >> foo && - git add foo && + stg add foo && git commit -m "Initial commit" && sed -i "s/000/000xx/" foo && git commit -a -m "First change" &&
t/t3400-pick.sh +4 -4
@@ -7,11 +7,11 @@ test_expect_success \ 'Initialize the StGIT repository' \ ' stg init && - stg new A -m "a" && echo A > a && git add a && stg refresh && - stg new B -m "b" && echo B > b && git add b && stg refresh && + stg new A -m "a" && echo A > a && stg add a && stg refresh && + stg new B -m "b" && echo B > b && stg add b && stg refresh && stg branch --clone foo && - stg new C -m "c" && echo C > c && git add c && stg refresh && - stg new D-foo -m "d" && echo D > d && git add d && stg refresh && + stg new C -m "c" && echo C > c && stg add c && stg refresh && + stg new D-foo -m "d" && echo D > d && stg add d && stg refresh && stg branch master '
t/t4100-publish.sh +6 -6
@@ -26,15 +26,15 @@ test_expect_success \ ' stg new p1 -m p1 && echo foo1 > foo1.txt && - git add foo1.txt && + stg add foo1.txt && stg refresh && stg new p2 -m p2 && echo foo2 > foo2.txt && - git add foo2.txt && + stg add foo2.txt && stg refresh && stg new p3 -m p3 && echo foo3 > foo3.txt && - git add foo3.txt && + stg add foo3.txt && stg refresh '
@@ -64,11 +64,11 @@ test_expect_success \ ' stg new p4 -m p4 && echo foo4 > foo4.txt && - git add foo4.txt && + stg add foo4.txt && stg refresh && stg new p5 -m p5 && echo foo5 > foo5.txt && - git add foo5.txt && + stg add foo5.txt && stg refresh && stg new empty -m empty && old_public=$(stg id master.public) &&
@@ -83,7 +83,7 @@ test_expect_success \ ' stg pop -a && echo foo0 > foo0.txt && - git add foo0.txt && + stg add foo0.txt && git commit -m "foo0.txt added" && stg push -a && old_public=$(stg id master.public) &&