diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-21 07:28:26 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-21 07:28:26 -0400 |
commit | 4c7a9d837a268480e61124bba84b5fb01ec3728f (patch) | |
tree | eb20c2f424a0b334316e25fa179d2307befba66d /becommands/merge.py | |
parent | 9ef6ad576c01444e35b91dfee8d05b39ec911d45 (diff) | |
download | bugseverywhere-4c7a9d837a268480e61124bba84b5fb01ec3728f.tar.gz |
Cleaned up saving/sync_with_disk.
Got rid of a whole bunch of redundant .save() calls when
sync_with_disk==True.
Fixed up the "File-system access" portion of the BugDir docstring so
we can all remember how things are supposed to work ;).
Note that some .save() calls are still required. For example in
becommands/merge.py, the copied comments have their .bug changed, but
that is not a versioned property, so it doesn't trigger an automatic
save, and we have to force the .save() by hand.
libbe.rcs.RCS.mkdir() is now recursive by default, but you can set
check_parents==False if you want it to fail in the case of missing
parents. Because of the recursion, we removed the .update() call
on preexisting directories, since there will be at least one of
these occurrences for every .mkdir(check_parents=True) call, and
I don't know of any VCS that actually needs them...
Also stripped trailing whitespace from some files...
Diffstat (limited to 'becommands/merge.py')
-rw-r--r-- | becommands/merge.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/becommands/merge.py b/becommands/merge.py index c030dd0..4aaefa8 100644 --- a/becommands/merge.py +++ b/becommands/merge.py @@ -22,6 +22,7 @@ def execute(args, test=False): """ >>> from libbe import utility >>> bd = bugdir.simple_bug_dir() + >>> bd.set_sync_with_disk(True) >>> a = bd.bug_from_shortname("a") >>> a.comment_root.time = 0 >>> dummy = a.new_comment("Testing") @@ -35,7 +36,6 @@ def execute(args, test=False): >>> dummy.time = 1 >>> dummy = dummy.new_reply("1 2 3 4") >>> dummy.time = 2 - >>> bd.save() >>> os.chdir(bd.root) >>> execute(["a", "b"], test=True) Merging bugs a and b @@ -140,13 +140,13 @@ def execute(args, test=False): bugB.load_comments() mergeA = bugA.new_comment("Merged from bug %s" % bugB.uuid) newCommTree = copy.deepcopy(bugB.comment_root) - for comment in newCommTree.traverse(): + for comment in newCommTree.traverse(): # all descendant comments comment.bug = bugA - for comment in newCommTree: + comment.save() # force onto disk under bugA + for comment in newCommTree: # just the child comments mergeA.add_reply(comment, allow_time_inversion=True) bugB.new_comment("Merged into bug %s" % bugA.uuid) bugB.status = "closed" - bd.save() print "Merging bugs %s and %s" % (bugA.uuid, bugB.uuid) def get_parser(): |