explicitly if you add, remove, or rename files.
To record the addition or deletion of files in your new patch:
- stg add [<file>*]
+ git add [<file>*]
stg rm [<file>*]
To record the renaming of a file in your new patch, issue both of these
commands:
stg rm <oldfilename>
- stg add <newfilename>
+ git add <newfilename>
Stack manipulation: managing multiple patches
+++ /dev/null
-
-__copyright__ = """
-Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-import sys, os
-from optparse import OptionParser, make_option
-
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit import stack, git
-
-
-help = 'add files or directories to the repository'
-usage = """%prog [options] <files/dirs...>
-
-Add the files or directories passed as arguments to the
-repository. When a directory name is given, all the files and
-subdirectories are recursively added."""
-
-directory = DirectoryHasRepository(needs_current_series = False)
-options = []
-
-
-def func(parser, options, args):
- """Add files or directories to the repository
- """
- if len(args) < 1:
- parser.error('incorrect number of arguments')
-
- git.add(args)
return getattr(stgit.commands, cmd_mod)
commands = Commands({
- 'add': 'add',
'applied': 'applied',
'branch': 'branch',
'delete': 'delete',
'sync',
)
wccommands = (
- 'add',
'cp',
'diff',
'resolved',
A foo/bar
EOF
test_expect_success 'Status with an added file' '
- stg add foo &&
+ git add foo &&
stg status > output.txt &&
diff -u expected.txt output.txt
'
test_expect_success 'Add another file' '
echo lajbans > fie &&
- stg add fie &&
+ git add fie &&
stg refresh
'
test_expect_success 'Status of disappeared newborn' '
stg refresh &&
touch foo/bar &&
- stg add foo/bar &&
+ git add foo/bar &&
rm foo/bar &&
stg status > output.txt &&
diff -u expected.txt output.txt
stg clone foo bar &&
(
cd bar && stg new p1 -m p1 &&
- printf "a\nc\n" > file && stg add file && stg refresh &&
+ printf "a\nc\n" > file && git add file && stg refresh &&
stg new p2 -m p2 &&
printf "a\nb\nc\n" > file && stg refresh &&
[ "$(echo $(stg applied))" = "p1 p2" ] &&
'
stg new foo -m foo &&
echo foo > test &&
- stg add test &&
+ git add test &&
stg refresh
'
'
stg new bar -m bar &&
echo bar > test &&
- stg add test &&
+ git add test &&
stg refresh
'
'Undo with disappeared newborn' \
'
touch newfile &&
- stg add newfile &&
+ git add newfile &&
rm newfile &&
stg push --undo
'
stg new foo -m foo &&
echo foo > test &&
echo fie > test2 &&
- stg add test test2 &&
+ git add test test2 &&
stg refresh &&
stg pop
'
'
stg new bar -m bar &&
echo bar > test &&
- stg add test &&
+ git add test &&
stg refresh
'
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 &&
+ git add patch$i.txt &&
stg refresh
done &&
[ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
stg new p$i -m p$i &&
echo x$i >> x.txt &&
echo y$i >> foo/y.txt &&
- stg add x.txt foo/y.txt &&
+ git add x.txt foo/y.txt &&
stg refresh
done &&
[ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
[ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
stg new extra -m extra &&
echo extra >> extra.txt &&
- stg add extra.txt &&
+ git add extra.txt &&
stg refresh &&
cd foo &&
stg push &&
stg new foo -m foo &&
mkdir d &&
echo foo > d/test &&
- stg add d/test &&
+ git add d/test &&
stg refresh &&
stg pop &&
mkdir -p d &&
'
stg new foo -m "Foo Patch" &&
echo foo > test &&
- stg add test &&
+ git add test &&
stg refresh
'
'
stg new bar -m "Bar Patch" &&
echo bar > test &&
- stg add test &&
+ git add test &&
stg refresh
'
'
stg new foo -m foo &&
echo foo > foo.txt &&
- stg add foo.txt &&
+ git add foo.txt &&
stg refresh
'
'
stg new foo -m "Foo Patch" &&
echo foo > test && echo foo2 >> test &&
- stg add test &&
+ git add test &&
stg refresh --annotate="foo notes"
'
'Check the "push" log' \
'
stg pop &&
- echo foo > test2 && stg add test2 && stg refresh &&
+ echo foo > test2 && git add test2 && stg refresh &&
stg push &&
stg log --full | grep -q -e "^push "
'
test_expect_success \
'Initialize the StGIT repository' \
'stg init &&
- 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 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 pop &&
test "$(echo $(stg applied))" = "A B C D E F"
'
'
stg new foo -m foo &&
echo foo > foo.txt &&
- stg add foo.txt &&
+ git add foo.txt &&
stg refresh
'
'
stg new foo -m foo &&
echo foo > foo.txt &&
- stg add foo.txt &&
+ git add foo.txt &&
stg refresh &&
stg pop
'
'
stg new foo -m foo &&
echo foo > foo.txt &&
- stg add foo.txt &&
+ git add foo.txt &&
stg refresh &&
stg new bar -m bar &&
echo bar > bar.txt &&
- stg add bar.txt &&
+ git add bar.txt &&
stg refresh
'
stg branch --create br &&
stg new baz -m baz &&
echo baz > baz.txt &&
- stg add baz.txt &&
+ git add baz.txt &&
stg refresh &&
stg branch master &&
stg new baz -m baz &&
echo baz > baz.txt &&
- stg add baz.txt &&
+ git add baz.txt &&
stg refresh
'
'
stg new p0 -m p0 &&
echo p0 > foo.txt &&
- stg add foo.txt &&
+ git 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 &&
'
stg new foo -m "Foo Patch" &&
echo foo > test &&
- stg add test &&
+ git add test &&
stg refresh
'
'
stg new p1 -m p1 &&
echo foo1 > foo1.txt &&
- stg add foo1.txt &&
+ git add foo1.txt &&
stg refresh &&
stg new p2 -m p2 &&
echo foo2 > foo2.txt &&
- stg add foo2.txt &&
+ git add foo2.txt &&
stg refresh &&
stg new p3 -m p3 &&
echo foo3 > foo3.txt &&
- stg add foo3.txt &&
+ git add foo3.txt &&
stg refresh &&
stg export &&
stg pop &&
stg refresh &&
stg goto p2 &&
echo bar2 > bar2.txt &&
- stg add bar2.txt &&
+ git add bar2.txt &&
stg refresh &&
stg goto p3 &&
echo bar3 >> foo3.txt &&
git repo-config branch.master.stgit.pull-policy fetch-rebase &&
git repo-config --list &&
stg new c1 -m c1 &&
- echo a > file && stg add file && stg refresh
+ echo a > file && git add file && stg refresh
)
'
'Add non-rewinding commit upstream and pull it from clone' \
'
(cd upstream && stg new u1 -m u1 &&
- echo a > file2 && stg add file2 && stg refresh) &&
+ echo a > file2 && git add file2 && stg refresh) &&
(cd clone && stg pull) &&
test -e clone/file2
'
git repo-config branch.master.stgit.pull-policy pull &&
git repo-config --list &&
stg new c1 -m c1 &&
- echo a > file && stg add file && stg refresh
+ echo a > file && git add file && stg refresh
)
'
'Add non-rewinding commit upstream and pull it from clone' \
'
(cd upstream && stg new u1 -m u1 &&
- echo a > file2 && stg add file2 && stg refresh) &&
+ echo a > file2 && git add file2 && stg refresh) &&
(cd clone && stg pull) &&
test -e clone/file2
'
git repo-config branch.stack.stgit.pull-policy rebase &&
git repo-config --list &&
stg new c1 -m c1 &&
- echo a > file && stg add file && stg refresh
+ echo a > file && git 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 && stg add file2 && stg refresh &&
+ echo b > file2 && git add file2 && stg refresh &&
stg branch stack && stg pull &&
test -e file2
'
echo foo >> foo.txt &&
mkdir bar &&
echo bar >> bar/bar.txt &&
- stg add foo.txt bar/bar.txt &&
+ git add foo.txt bar/bar.txt &&
cd bar &&
stg refresh &&
cd .. &&