[PATCH 0/4] StGIT minor clean ups
A few minor typos and additional error checking.
-- Chuck Lever -- corporate: <cel at netapp dot com> personal: <chucklever at bigfoot dot com>
threads / patch / 2504
Subject: [PATCH 4/4] Fix a typo in the "add" command's documentation
[PATCH 0/4] StGIT minor clean ups
A few minor typos and additional error checking.
-- Chuck Lever -- corporate: <cel at netapp dot com> personal: <chucklever at bigfoot dot com>
[PATCH 1/4] Better error message when renaming patches to same name
Generate a more precise error message when trying to rename a patch to the same name. This is what we get currently:
[cel@dexter main]$ stg rename nfs_direct_wait nfs_direct_wait Renaming patch "nfs_direct_wait" -> "nfs_direct_wait"...stg rename: Patch "nfs_direct_wait" already exists
[cel@dexter main]$
Signed-off-by: Chuck Lever <cel@netapp.com> ---
stgit/stack.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py index 1ffeaee..0907b37 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -775,6 +775,9 @@ class Series: applied = self.get_applied() unapplied = self.get_unapplied() + if oldname == newname: + raise StackException, '"To" name and "from" name are the same' + if newname in applied or newname in unapplied: raise StackException, 'Patch "%s" already exists' % newname
[PATCH 2/4] use "crt_series.get_branch()" instead of "git.get_head_file()"
More cleanup to the branch command.
Signed-off-by: Chuck Lever <cel@netapp.com> ---
stgit/commands/branch.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index d85ba69..9bf6cdb 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -147,7 +147,7 @@ def func(parser, options, args): elif options.protect: if len(args) == 0: - branch_name = git.get_head_file() + branch_name = crt_series.get_branch() elif len(args) == 1: branch_name = args[0] else: @@ -182,7 +182,7 @@ def func(parser, options, args): elif options.unprotect: if len(args) == 0: - branch_name = git.get_head_file() + branch_name = crt_series.get_branch() elif len(args) == 1: branch_name = args[0] else: @@ -222,4 +222,4 @@ def func(parser, options, args): if len(args) != 0: parser.error('incorrect number of arguments') - print git.get_head_file() + print crt_series.get_branch()
[PATCH 3/4] Fix a typo in "stg pick"
"Unknown" is misspelled.
Signed-off-by: Chuck Lever <cel@netapp.com> ---
stgit/commands/pick.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py index 3c52a49..c01c799 100644 --- a/stgit/commands/pick.py +++ b/stgit/commands/pick.py @@ -64,7 +64,7 @@ def func(parser, options, args): elif len(patch_branch) == 2: patch = patch_branch[0] else: - raise CmdException, 'Unkown patch name' + raise CmdException, 'Unknown patch name' commit_id = git_id(commit_str) commit = git.Commit(commit_id)
Signed-off-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <cel@netapp.com> ---
stgit/commands/add.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stgit/commands/add.py b/stgit/commands/add.py index 999ce2b..fc9c5a7 100644 --- a/stgit/commands/add.py +++ b/stgit/commands/add.py @@ -27,7 +27,7 @@ from stgit import stack, git help = 'add files or directories to the repository' usage = """%prog [options] <files/dirs...> -Add a the files or directories passed as arguments to the +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."""