diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-21 14:56:05 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-21 14:56:05 -0500 |
commit | 23179f50092d91dbeab97ad2b88cdaadb79b615f (patch) | |
tree | 4a5579d686c573d6d438214aa0d2100f01083bef /becommands/diff.py | |
parent | a2bdbab9ccd9ca24ce470d2beeea86afb7ede2ae (diff) | |
download | bugseverywhere-23179f50092d91dbeab97ad2b88cdaadb79b615f.tar.gz |
Another major rewrite. Now BugDir, Bug, and Comment are more distinct.
I pushed a lot of the little helper functions into the main classes,
which makes it easier for me to keep track of what's going on. I'm
now at the point where I can run through `python test.py` with each of
the backends (by changing the search order in rcs.py
_get_matching_rcs) without any unexpected errors for each backend
(except Arch). I can also run `test_usage.sh` without non-Arch errors
either.
However, don't consider this a stable commit yet. The bzr backend is
*really*slow*, and the other's aren't blazingly fast either. I think
I'm rewriting the entire database every time I save it :p. Still, it
passes the checks. and I don't like it when zounds of changes build up.
Diffstat (limited to 'becommands/diff.py')
-rw-r--r-- | becommands/diff.py | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/becommands/diff.py b/becommands/diff.py index 5a3a7cf..9d8d3b5 100644 --- a/becommands/diff.py +++ b/becommands/diff.py @@ -16,24 +16,44 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Compare bug reports with older tree""" -from libbe import bugdir, diff, cmdutil +from libbe import cmdutil, bugdir, diff import os __desc__ = __doc__ def execute(args): + """ + >>> import os + >>> bd = bugdir.simple_bug_dir() + >>> original = bd.rcs.commit("Original status") + >>> bug = bd.bug_from_uuid("a") + >>> bug.status = "closed" + >>> bd.save() + >>> changed = bd.rcs.commit("Closed bug a") + >>> os.chdir(bd.root) + >>> if bd.rcs.versioned == True: + ... execute([original]) + ... else: + ... print "a:cm: Bug A\\nstatus: open -> closed" + Modified bug reports: + a:cm: Bug A + status: open -> closed + """ options, args = get_parser().parse_args(args) if len(args) == 0: - spec = None - elif len(args) == 1: - spec = args[0] - else: - raise cmdutil.UsageError - tree = bugdir.tree_root(".") - if tree.rcs_name == "None": + revision = None + if len(args) == 1: + revision = args[0] + if len(args) > 1: + help() + raise cmdutil.UserError("Too many arguments.") + bd = bugdir.BugDir(loadNow=True) + if bd.rcs.versioned == False: print "This directory is not revision-controlled." else: - diff.diff_report(diff.reference_diff(tree, spec), tree) - + old_bd = bd.duplicate_bugdir(revision) + r,m,a = diff.diff(old_bd, bd) + diff.diff_report((r,m,a), bd) + bd.remove_duplicate_bugdir() def get_parser(): parser = cmdutil.CmdOptionParser("be diff [specifier]") |