diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-25 15:22:30 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-25 15:22:30 -0400 |
commit | 59be08453137a3b9c6a25dc6787b5066a88a84cd (patch) | |
tree | dfc5acde52c5cd72895dcd9af7c46260f2a11e1a /b4/mbox.py | |
parent | 34bcb457865d0b58e08486b2ceb80e9067717e60 (diff) | |
download | b4-59be08453137a3b9c6a25dc6787b5066a88a84cd.tar.gz |
Add -3 to "b4 am" to prep for a 3way merge
The original code used for b4 diff was to prepare for a 3-way merge by
making sure that all blob indexes exist in the local repo. Add this
functionality to "b4 am" and document all the features added in the
0.5.0 branch.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/mbox.py')
-rw-r--r-- | b4/mbox.py | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -123,6 +123,23 @@ def mbox_to_am(mboxfile, cmdargs): logger.critical(' From: %s <%s>', fname, femail) logger.critical('NOTE: Rerun with -S to apply them anyway') + topdir = None + # Are we in a git tree and if so, what is our toplevel? + gitargs = ['rev-parse', '--show-toplevel'] + lines = b4.git_get_command_lines(None, gitargs) + if len(lines) == 1: + topdir = lines[0] + + if cmdargs.threeway: + if not topdir: + logger.critical('WARNING: cannot prepare 3-way (not in a git dir)') + elif not lser.complete: + logger.critical('WARNING: cannot prepare 3-way (series incomplete)') + else: + rstart, rend = lser.make_fake_am_range(gitdir=None) + if rstart and rend: + logger.info('Prepared a fake commit range for 3-way merge (%.12s..%.12s)', rstart, rend) + logger.critical('---') if not lser.complete: logger.critical('WARNING: Thread incomplete!') @@ -165,11 +182,7 @@ def mbox_to_am(mboxfile, cmdargs): logger.critical(' git am %s', am_filename) else: cleanmsg = '' - # Are we in a git tree and if so, what is our toplevel? - gitargs = ['rev-parse', '--show-toplevel'] - lines = b4.git_get_command_lines(None, gitargs) - if len(lines) == 1: - topdir = lines[0] + if topdir is not None: checked, mismatches = lser.check_applies_clean(topdir) if mismatches == 0 and checked != mismatches: cleanmsg = ' (applies clean to current tree)' |