Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
options = [make_option('-d', '--diff',
help = 'show the diff for the given files',
options = [make_option('-d', '--diff',
help = 'show the diff for the given files',
- action = 'store_true')]
+ action = 'store_true'),
+ make_option('-b', '--branch',
+ help = 'use BRANCH instead of the default one')]
diff_tmpl = \
'-------------------------------------------------------------------------------\n' \
diff_tmpl = \
'-------------------------------------------------------------------------------\n' \
if not applied:
raise CmdException, 'No patches applied'
if not applied:
raise CmdException, 'No patches applied'
- revs = git.modifying_revs(args, git_id('base'))
+ revs = git.modifying_revs(args, crt_series.get_base(),
+ crt_series.get_head())
revs.reverse()
# build the patch/revision mapping
revs.reverse()
# build the patch/revision mapping
raise GitException, 'Failed "git-clone %s %s"' \
% (repository, local_dir)
raise GitException, 'Failed "git-clone %s %s"' \
% (repository, local_dir)
-def modifying_revs(files, base_rev):
+def modifying_revs(files, base_rev, head_rev):
"""Return the revisions from the list modifying the given files
"""
"""Return the revisions from the list modifying the given files
"""
- cmd = ['git-rev-list', '%s..' % base_rev, '--']
+ cmd = ['git-rev-list', '%s..%s' % (base_rev, head_rev), '--']
revs = [line.strip() for line in _output_lines(cmd + files)]
return revs
revs = [line.strip() for line in _output_lines(cmd + files)]
return revs
def get_base(self):
return read_string(self.get_base_file())
def get_base(self):
return read_string(self.get_base_file())
+ def get_head(self):
+ """Return the head of the branch
+ """
+ crt = self.get_current_patch()
+ if crt:
+ return crt.get_top()
+ else:
+ return self.get_base()
+
def get_protected(self):
return os.path.isfile(os.path.join(self._dir(), 'protected'))
def get_protected(self):
return os.path.isfile(os.path.join(self._dir(), 'protected'))