diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-15 06:44:20 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-15 06:44:20 -0500 |
commit | 89b7a1411e4658e831f5d635534b24355dbb941d (patch) | |
tree | 77f84979931ac4bf8bcf14d293154fe29e8491bc /libbe/command/import_xml.py | |
parent | 380889988b6d7881c4e0b5968053f85676d27211 (diff) | |
download | bugseverywhere-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/import_xml.py')
-rw-r--r-- | libbe/command/import_xml.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbe/command/import_xml.py b/libbe/command/import_xml.py index e73d90f..2e96848 100644 --- a/libbe/command/import_xml.py +++ b/libbe/command/import_xml.py @@ -110,9 +110,9 @@ class Import_XML (libbe.command.Command): new.explicit_attrs = [] else: croot_bug,croot_comment = (None, None) - + if params['xml-file'] == '-': - xml = self.stdin.read().encode(self.stdin.encoding) + xml = self.stdin.read().encode(self.stdin.encoding) else: self._check_restricted_access(storage, params['xml-file']) xml = libbe.util.encoding.get_file_contents( @@ -147,7 +147,7 @@ class Import_XML (libbe.command.Command): else: print >> sys.stderr, 'ignoring unknown tag %s in %s' \ % (child.tag, comment_list.tag) - + # merge the new root_comments if params['add-only'] == True: accept_changes = False @@ -172,7 +172,7 @@ class Import_XML (libbe.command.Command): croot_bug.merge(new_croot_bug, accept_changes=accept_changes, accept_extra_strings=accept_extra_strings, accept_comments=accept_comments) - + # merge the new croot_bugs merged_bugs = [] old_bugs = [] @@ -190,7 +190,7 @@ class Import_XML (libbe.command.Command): accept_comments=accept_comments) merged_bugs.append(new) old_bugs.append(old) - + # protect against programmer error causing data loss: if croot_bug != None: comms = [c.uuid for c in croot_comment.traverse()] @@ -201,7 +201,7 @@ class Import_XML (libbe.command.Command): if not new in merged_bugs: assert bugdir.has_bug(new.uuid), \ "bug %s wasn't added" % (new.uuid) - + # save new information bugdir.storage.writeable = writeable if croot_bug != None: |