aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-22 19:45:37 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-22 19:45:37 -0500
commit4a626e67b3f401b8e242a55571a802147123a196 (patch)
treee5907e6e16e9110a092d723e43f34571a4cac378
parent9524d061aa93451a282f45150944878d6b5cf065 (diff)
downloadbugseverywhere-4a626e67b3f401b8e242a55571a802147123a196.tar.gz
Explicit rcs.cleanup() in bugdir test.
Don't use del(rcs), because if there was an error, there is still a reference to rcs in the traceback, so it is never cleaned up. This can leave the external archive cluttering up your Arch install if you're using the Arch backend. See the __del__ documentation http://python.active-venture.com/ref/customization.html#l2h-175 for details. Also fixed some out-of-date method names in libbe.diff
-rw-r--r--.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body17
-rw-r--r--.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values21
-rw-r--r--.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values35
-rw-r--r--libbe/arch.py19
-rw-r--r--libbe/bugdir.py6
-rw-r--r--libbe/diff.py4
-rw-r--r--libbe/utility.py5
7 files changed, 88 insertions, 19 deletions
diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body
new file mode 100644
index 0000000..7f46872
--- /dev/null
+++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/body
@@ -0,0 +1,17 @@
+Example:
+
+We're working happily in a versioned bugdir, and our RCS knows who we
+are. We create a temporary repository copy from a previous revision
+for diff generation. We set the RCS for the copy to "None", since we
+didn't bother initializing our normal RCS in the snapshot copy. But
+now the BugDir instantized on the copy doesn't know who we are!
+
+Solution:
+
+Track user id in the bugdir settings file. If you
+bugdir.settings["user_id"], it will be saved and loaded. When loaded,
+it will also set bugdir.user_id. If you set rcs.user_id, it will be
+returned by rcs.get_user_id(), instead of returing the output of
+rcs._rcs_get_user_id(). We should be caching the output of
+_rcs_get_user_id() anyway.
+
diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values
new file mode 100644
index 0000000..368afb3
--- /dev/null
+++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/comments/208595bd-35b8-44c2-bf97-fc5ef9e7a58d/values
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Sat, 22 Nov 2008 21:43:29 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
diff --git a/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values
new file mode 100644
index 0000000..9992d72
--- /dev/null
+++ b/.be/bugs/c894f10f-197d-4b22-9c5b-19f394df40d4/values
@@ -0,0 +1,35 @@
+
+
+
+creator=W. Trevor King <wking@drexel.edu>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=open
+
+
+
+
+
+
+summary=Allow user id to be cached in settings for duplicate bugdirs
+
+
+
+
+
+
+time=Sat, 22 Nov 2008 21:36:06 +0000
+
+
+
diff --git a/libbe/arch.py b/libbe/arch.py
index 6415cef..ba341e6 100644
--- a/libbe/arch.py
+++ b/libbe/arch.py
@@ -21,9 +21,6 @@ import re
import unittest
import doctest
-import traceback
-import sys
-
import config
from beuuid import uuid_gen
from rcs import RCS, RCStestCase, CommandError
@@ -58,10 +55,6 @@ class Arch(RCS):
self._create_archive(path)
self._create_project(path)
self._add_project_code(path)
- #print "RCSid:", id(self), "init", self._archive_project_name()
- #print "BEGIN_TRACE"
- #traceback.print_stack(file=sys.stdout)
- #print "END_TRACE"
def _create_archive(self, path):
# Create a new archive
# http://regexps.srparish.net/tutorial-tla/new-archive.html#Creating_a_New_Archive
@@ -102,6 +95,11 @@ class Arch(RCS):
self._archive_dir = False
self._archive_name = False
def _create_project(self, path):
+ """
+ Create a temporary Arch project in the directory PATH. This
+ project will be removed by
+ __del__->cleanup->_rcs_cleanup->_remove_project
+ """
# http://mwolson.org/projects/GettingStartedWithArch.html
# http://regexps.srparish.net/tutorial-tla/new-project.html#Starting_a_New_Project
category = "bugs-everywhere"
@@ -110,6 +108,7 @@ class Arch(RCS):
self._project_name = "%s--%s--%s" % (category, branch, version)
self._invoke_client("archive-setup", self._project_name,
directory=path)
+ self._tmp_project = True
def _remove_project(self):
assert self._tmp_project == True
assert self._project_name != None
@@ -153,16 +152,11 @@ class Arch(RCS):
self._invoke_client("import", "--summary", "Began versioning",
directory=path)
def _rcs_cleanup(self):
- #print "RCSid:", id(self), "cleaned", self._archive_project_name()
- #print "BEGIN_TRACE"
- #traceback.print_stack(file=sys.stdout)
- #print "END_TRACE"
if self._tmp_project == True:
self._remove_project()
if self._tmp_archive == True:
self._remove_archive()
-
def _rcs_root(self, path):
if not os.path.isdir(path):
dirname = os.path.dirname(path)
@@ -195,7 +189,6 @@ class Arch(RCS):
archive_name,project_name = output.rstrip('\n').split('/')
self._archive_name = archive_name
self._project_name = project_name
-
def _rcs_get_user_id(self):
try:
self._u_invoke_client("archives")
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index a552b0f..cc21878 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -363,8 +363,8 @@ class BugDirTestCase(unittest.TestCase):
self.bugdir = BugDir(self.dir.path, sink_to_existing_root=False, allow_rcs_init=True)
self.rcs = self.bugdir.rcs
def tearDown(self):
- del(self.rcs)
- del(self.dir)
+ self.rcs.cleanup()
+ self.dir.cleanup()
def fullPath(self, path):
return os.path.join(self.dir.path, path)
def assertPathExists(self, path):
@@ -410,4 +410,4 @@ class BugDirTestCase(unittest.TestCase):
self.versionTest()
unitsuite = unittest.TestLoader().loadTestsFromTestCase(BugDirTestCase)
-suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()])
+suite = unittest.TestSuite([unitsuite])#, doctest.DocTestSuite()])
diff --git a/libbe/diff.py b/libbe/diff.py
index 95d5607..470a864 100644
--- a/libbe/diff.py
+++ b/libbe/diff.py
@@ -87,11 +87,11 @@ def bug_changes(old, new, bugs):
change_strings = ["%s: %s -> %s" % f for f in change_list]
for comment_id in new_comment_ids:
if comment_id not in old_comment_ids:
- summary = comment_summary(new.get_comment(comment_id), "new")
+ summary = comment_summary(new.comment_root.comment_from_uuid(comment_id), "new")
change_strings.append(summary)
for comment_id in old_comment_ids:
if comment_id not in new_comment_ids:
- summary = comment_summary(new.get_comment(comment_id), "removed")
+ summary = comment_summary(new.comment.root.comment_from_uuid(comment_id), "removed")
change_strings.append(summary)
if len(change_strings) == 0:
diff --git a/libbe/utility.py b/libbe/utility.py
index 972fe47..f156ce9 100644
--- a/libbe/utility.py
+++ b/libbe/utility.py
@@ -97,12 +97,15 @@ def search_parent_directories(path, filename):
old_path = path
path = os.path.dirname(path)
-class Dir:
+class Dir (object):
"A temporary directory for testing use"
def __init__(self):
self.path = tempfile.mkdtemp(prefix="BEtest")
self.shutil = shutil # save local reference for __del__
def __del__(self):
+ self.cleanup()
+ def cleanup(self):
+ print "Removing", self.path
self.shutil.rmtree(self.path)
def __call__(self):
return self.path