chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'stable'
[stgit]
/
stgit
/
commands
/
branch.py
diff --git
a/stgit/commands/branch.py
b/stgit/commands/branch.py
index 33a8afe2aa5ea6edf0b40911b8ff5509d97a3dcb..3d912fc3f8ce4938900200ba6e1fd5b205c9c64f 100644
(file)
--- a/
stgit/commands/branch.py
+++ b/
stgit/commands/branch.py
@@
-20,9
+20,11
@@
from stgit.argparse import opt
from stgit.commands.common import *
from stgit.utils import *
from stgit.out import *
from stgit.commands.common import *
from stgit.utils import *
from stgit.out import *
-from stgit import stack, git, basedir
+from stgit import argparse, stack, git, basedir
+from stgit.lib import log
help = 'Branch operations: switch, list, create, rename, delete, ...'
help = 'Branch operations: switch, list, create, rename, delete, ...'
+kind = 'stack'
usage = ['',
'<branch>',
'--list',
usage = ['',
'<branch>',
'--list',
@@
-43,6
+45,7
@@
within a git repository.
'stg branch' <branch>::
Switch to the given branch."""
'stg branch' <branch>::
Switch to the given branch."""
+args = [argparse.all_branches]
options = [
opt('-l', '--list', action = 'store_true',
short = 'List the branches contained in this repository', long = """
options = [
opt('-l', '--list', action = 'store_true',
short = 'List the branches contained in this repository', long = """
@@
-101,7
+104,7
@@
options = [
opt('--force', action = 'store_true',
short = 'Force a delete when the series is not empty')]
opt('--force', action = 'store_true',
short = 'Force a delete when the series is not empty')]
-directory = DirectoryGotoToplevel()
+directory = DirectoryGotoToplevel(
log = False
)
def __is_current_branch(branch_name):
return crt_series.get_name() == branch_name
def __is_current_branch(branch_name):
return crt_series.get_name() == branch_name
@@
-195,6
+198,7
@@
def func(parser, options, args):
parent_branch = parentbranch)
out.info('Branch "%s" created' % args[0])
parent_branch = parentbranch)
out.info('Branch "%s" created' % args[0])
+ log.compat_log_entry('branch --create')
return
elif options.clone:
return
elif options.clone:
@@
-215,6
+219,8
@@
def func(parser, options, args):
crt_series.clone(clone)
out.done()
crt_series.clone(clone)
out.done()
+ log.copy_log(log.default_repo(), crt_series.get_name(), clone,
+ 'branch --clone')
return
elif options.delete:
return
elif options.delete:
@@
-222,6
+228,7
@@
def func(parser, options, args):
if len(args) != 1:
parser.error('incorrect number of arguments')
__delete_branch(args[0], options.force)
if len(args) != 1:
parser.error('incorrect number of arguments')
__delete_branch(args[0], options.force)
+ log.delete_log(log.default_repo(), args[0])
return
elif options.list:
return
elif options.list:
@@
-229,13
+236,16
@@
def func(parser, options, args):
if len(args) != 0:
parser.error('incorrect number of arguments')
if len(args) != 0:
parser.error('incorrect number of arguments')
- branches = git.get_heads()
- branches.sort()
+ branches = set(git.get_heads())
+ for br in set(branches):
+ m = re.match(r'^(.*)\.stgit$', br)
+ if m and m.group(1) in branches:
+ branches.remove(br)
if branches:
out.info('Available branches:')
max_len = max([len(i) for i in branches])
if branches:
out.info('Available branches:')
max_len = max([len(i) for i in branches])
- for i in
branches
:
+ for i in
sorted(branches)
:
__print_branch(i, max_len)
else:
out.info('No branches')
__print_branch(i, max_len)
else:
out.info('No branches')
@@
-272,7
+282,7
@@
def func(parser, options, args):
stack.Series(args[0]).rename(args[1])
out.info('Renamed branch "%s" to "%s"' % (args[0], args[1]))
stack.Series(args[0]).rename(args[1])
out.info('Renamed branch "%s" to "%s"' % (args[0], args[1]))
-
+ log.rename_log(log.default_repo(), args[0], args[1], 'branch --rename')
return
elif options.unprotect:
return
elif options.unprotect: