aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/commit.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-15 06:44:20 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-15 06:44:20 -0500
commit89b7a1411e4658e831f5d635534b24355dbb941d (patch)
tree77f84979931ac4bf8bcf14d293154fe29e8491bc /libbe/command/commit.py
parent380889988b6d7881c4e0b5968053f85676d27211 (diff)
downloadbugseverywhere-89b7a1411e4658e831f5d635534b24355dbb941d.tar.gz
Fixed libbe.command.diff + ugly BugDir.duplicate_bugdir implementation
duplicate_bugdir() works, but for the vcs backends, it could require shelling out for _every_ file read. This could, and probably will, be horribly slow. Still it works ;). I'm not sure what a better implementation would be. The old implementation checked out the entire earlier state into a temporary directory pros: single shell out, simple upgrade implementation cons: wouldn't work well for HTTP backens I think a good solution would run along the lines of the currently commented out code in duplicate_bugdir(), where a VersionedStorage.changed_since(revision) call would give you a list of changed files. diff could work off of that directly, without the need to generate a whole duplicate bugdir. I'm stuck on how to handle upgrades though... Also removed trailing whitespace from all python files.
Diffstat (limited to 'libbe/command/commit.py')
-rw-r--r--libbe/command/commit.py27
1 files changed, 8 insertions, 19 deletions
diff --git a/libbe/command/commit.py b/libbe/command/commit.py
index 4ef619c..7d82e7d 100644
--- a/libbe/command/commit.py
+++ b/libbe/command/commit.py
@@ -27,30 +27,19 @@ import libbe.ui.util.editor
class Commit (libbe.command.Command):
"""Commit the currently pending changes to the repository
- >>> import os, sys
- >>> import libbe.storage.vcs
- >>> import libbe.storage.vcs.base
- >>> import libbe.util.utility
+ >>> import sys
+ >>> import libbe.bugdir
+ >>> bd = libbe.bugdir.SimpleBugDir(memory=False, versioned=True)
>>> cmd = Commit()
+ >>> cmd._storage = bd.storage
>>> cmd._setup_io = lambda i_enc,o_enc : None
>>> cmd.stdout = sys.stdout
- >>> dir = libbe.util.utility.Dir()
- >>> vcs = libbe.storage.vcs.installed_vcs()
- >>> vcs.repo = dir.path
- >>> vcs.init()
- >>> vcs.connect()
- >>> cmd._storage = vcs
- >>> if vcs.name in libbe.storage.vcs.base.VCS_ORDER:
- ... bd = libbe.bugdir.BugDir(vcs, from_storage=False)
- ... bd.extra_strings = ['hi there']
- ... cmd.run({'user-id':'Joe'}, ['Making a commit']) # doctest: +ELLIPSIS
- ... else:
- ... print 'Committed ...'
+ >>> bd.extra_strings = ['hi there']
+ >>> bd.flush_reload()
+ >>> cmd.run({'user-id':'Joe'}, ['Making a commit']) # doctest: +ELLIPSIS
Committed ...
- >>> vcs.disconnect()
- >>> vcs.destroy()
- >>> dir.cleanup()
+ >>> bd.cleanup()
"""
name = 'commit'