From 41c369fafb6b775c50ba1d50efc57c024449b97c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 14 Nov 2008 00:24:08 -0500 Subject: Replaced libbe.arch.invoke() with general rcs.invoke() --- libbe/arch.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index 038325a..001f852 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -14,28 +14,17 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from subprocess import Popen, PIPE import os import config import errno + +from rcs import invoke + client = config.get_val("arch_client") if client is None: client = "tla" config.set_val("arch_client", client) -def invoke(args): - try : - q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) - except OSError, e : - strerror = "%s\nwhile executing %s" % (e.args[1], args) - raise Exception("Command failed: %s" % strerror) - output = q.stdout.read() - error = q.stderr.read() - status = q.wait() - if status >= 0: - return status, output, error - raise Exception("Command failed: %s" % error) - def invoke_client(*args, **kwargs): cl_args = [client] -- cgit From 19b153b9a86377a2b30cc80fa3f475fed892e2fe Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 18 Nov 2008 20:42:50 -0500 Subject: Major rewrite of RCS backends. RCS now represented as a class. Lots of changes and just one commit. This started with bug dac91856-cb6a-4f69-8c03-38ff0b29aab2, when I noticed that new bugs were not being added appropriately with the Git backend. I'd been working with Git trouble before with bug 0cad2ac6-76ef-4a88-abdf-b2e02de76f5c, and decided things would be better off if I just scrapped the current RCS architecture and went to a more object oriented setup. So I did. It's not clear how to add support for an RCS backend: * Create a new module that - defines an inheritor of rsc.RCS, overriding the _rcs_*() methods - provide a new() function for instantizating the new class - defines an inheritor of rcs.RCStestCase, overiding the Class attribute - defines 'suite' a unittest.TestSuite testing the module * Add your new module to the rest in rcs._get_matching_rcs() * Add your new module to the rest in libbe/tests.py Although I'm not sure libbe/tests.py is still usefull. The new framework clears out a bunch of hackery that used to be involved with supporting becommands/diff.py. There's still room for progress though. While implementing the new verision, I moved the testing framework over from doctest to a doctest/unittest combination. Longer tests that don't demonstrate a function's usage should be moved to unittests at the end of the module, since unittest has better support for setup/teardown, etc. The new framework also revealed some underimplented backends, most notably arch. These backends have now been fixed. I also tweaked the test_usage.sh script to run through all the backends if it is called with no arguments. The fix for the dac bug turned out to be an unflushed file write :p. --- libbe/arch.py | 357 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 191 insertions(+), 166 deletions(-) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index 001f852..8e7390d 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -15,184 +15,209 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os -import config -import errno +import shutil +import time +import re +import unittest +import doctest -from rcs import invoke +import config +from rcs import RCS, RCStestCase, CommandError client = config.get_val("arch_client") if client is None: client = "tla" config.set_val("arch_client", client) - -def invoke_client(*args, **kwargs): - cl_args = [client] - cl_args.extend(args) - status,output,error = invoke(cl_args) - if status not in (0,): - raise Exception("Command failed: %s" % error) - return output - -def get_user_id(): - try: - return invoke_client('my-id') - except Exception, e: - if 'no arch user id set' in e.args[0]: - return None +def new(): + return Arch() + +class Arch(RCS): + name = "Arch" + client = client + versioned = True + _archive_name = None + _archive_dir = None + _tmp_archive = False + _project_name = None + _tmp_project = False + _arch_paramdir = os.path.expanduser("~/.arch-params") + def _rcs_help(self): + status,output,error = self._u_invoke_client("--help") + return output + def _rcs_detect(self, path): + """Detect whether a directory is revision-controlled using Arch""" + if self._u_search_parent_directories(path, "{arch}") != None : + return True + return False + def _rcs_root(self, path): + if not os.path.isdir(path): + dirname = os.path.dirname(path) else: - raise - - -def set_user_id(value): - invoke_client('my-id', value) - - -def ensure_user_id(): - if get_user_id() is None: - set_user_id('nobody ') - - -def write_tree_settings(contents, path): - file(os.path.join(path, "{arch}", "=tagging-method"), "wb").write(contents) - -def init_tree(path): - invoke_client("init-tree", "-d", path) - -def temp_arch_tree(type="easy"): - import tempfile - ensure_user_id() - path = tempfile.mkdtemp() - init_tree(path) - if type=="easy": - write_tree_settings("source ^.*$\n", path) - elif type=="tricky": - write_tree_settings("source ^$\n", path) - else: - assert (type=="impossible") - add_dir_rule("precious ^\.boo$", path, path) - return path - -def list_added(root): - assert os.path.exists(root) - assert os.access(root, os.X_OK) - root = os.path.realpath(root) - inv_str = invoke_client("inventory", "--source", '--both', '--all', root) - return [os.path.join(root, p) for p in inv_str.split('\n')] - -def tree_root(filename): - assert os.path.exists(filename) - if not os.path.isdir(filename): - dirname = os.path.dirname(filename) - else: - dirname = filename - return invoke_client("tree-root", dirname).rstrip('\n') - -def rel_filename(filename, root): - filename = os.path.realpath(filename) - root = os.path.realpath(root) - assert(filename.startswith(root)) - return filename[len(root)+1:] + dirname = path + status,output,error = self._u_invoke_client("tree-root", dirname) + # get archive name... + return output.rstrip('\n') + def _rcs_init(self, path): + self._create_archive(path) + self._create_project(path) + self._add_project_code(path) + def _create_archive(self, path): + # Create a new archive + # http://regexps.srparish.net/tutorial-tla/new-archive.html#Creating_a_New_Archive + assert self._archive_name == None + id = self.get_user_id() + name, email = self._u_parse_id(id) + if email == None: + email = "%s@example.com" % name + trailer = "%s-%s" % ("bugs-everywhere-auto", + time.strftime("%Y.%H.%M.%S")) + self._archive_name = "%s--%s" % (email, trailer) + self._archive_dir = "/tmp/%s" % trailer + self._tmp_archive = True + self._u_invoke_client("make-archive", self._archive_name, + self._archive_dir, directory=path) + def _invoke_client(self, *args, **kwargs): + """ + Invoke the client on our archive. + """ + assert self._archive_name != None + command = args[0] + if len(args) > 1: + tailargs = args[1:] + else: + tailargs = [] + arglist = [command, "-A", self._archive_name] + arglist.extend(tailargs) + args = tuple(arglist) + return self._u_invoke_client(*args, **kwargs) + def _remove_archive(self): + assert self._tmp_archive == True + assert self._archive_dir != None + assert self._archive_name != None + os.remove(os.path.join(self._arch_paramdir, + "=locations", self._archive_name)) + shutil.rmtree(self._archive_dir) + self._tmp_archive = False + self._archive_dir = False + self._archive_name = False + def _create_project(self, path): + # http://mwolson.org/projects/GettingStartedWithArch.html + # http://regexps.srparish.net/tutorial-tla/new-project.html#Starting_a_New_Project + category = "bugs-everywhere" + branch = "mainline" + version = "0.1" + self._project_name = "%s--%s--%s" % (category, branch, version) + self._invoke_client("archive-setup", self._project_name, + directory=path) + def _remove_project(self): + assert self._tmp_project == True + assert self._project_name != None + assert self._archive_dir != None + shutil.rmtree(os.path.join(self._archive_dir, self._project_name)) + self._tmp_project = False + self._project_name = False + def _archive_project_name(self): + assert self._archive_name != None + assert self._project_name != None + return "%s/%s" % (self._archive_name, self._project_name) + def _add_project_code(self, path): + # http://mwolson.org/projects/GettingStartedWithArch.html + # http://regexps.srparish.net/tutorial-tla/importing-first.html#Importing_the_First_Revision + self._u_invoke_client("init-tree", self._archive_project_name(), + directory=path) + self._invoke_client("import", "--summary", "Began versioning", + directory=path) + def _rcs_cleanup(self): + if self._tmp_project == True: + self._remove_project() + if self._tmp_archive == True: + self._remove_archive() + def _rcs_get_user_id(self): + try: + status,output,error = self._u_invoke_client('my-id') + return output.rstrip('\n') + except Exception, e: + if 'no arch user id set' in e.args[0]: + return None + else: + raise + def _rcs_set_user_id(self, value): + self._u_invoke_client('my-id', value) + def _rcs_add(self, path): + self._u_invoke_client("add-id", path) + realpath = os.path.realpath(self._u_abspath(path)) + pathAdded = realpath in self._list_added(self.rootdir) + if self.paranoid and not pathAdded: + self._force_source(path) + def _list_added(self, root): + assert os.path.exists(root) + assert os.access(root, os.X_OK) + root = os.path.realpath(root) + status,output,error = self._u_invoke_client("inventory", "--source", + "--both", "--all", root) + inv_str = output.rstrip('\n') + return [os.path.join(root, p) for p in inv_str.split('\n')] + def _add_dir_rule(self, rule, dirname, root): + inv_path = os.path.join(dirname, '.arch-inventory') + file(inv_path, "ab").write(rule) + if os.path.realpath(inv_path) not in self._list_added(root): + paranoid = self.paranoid + self.paranoid = False + self.add(inv_path) + self.paranoid = paranoid + def _force_source(self, path): + rule = "source %s\n" % self._u_rel_path(path) + self._add_dir_rule(rule, os.path.dirname(path), self.rootdir) + if os.path.realpath(path) not in self._list_added(self.rootdir): + raise CantAddFile(path) + def _rcs_remove(self, path): + if not '.arch-ids' in path: + self._u_invoke_client("delete-id", path) + def _rcs_update(self, path): + pass + def _rcs_get_file_contents(self, path, revision=None): + if revision == None: + return file(self._u_abspath(path), "rb").read() + else: + status,output,error = \ + self._invoke_client("file-find", path, revision) + path = output.rstrip('\n') + return file(self._u_abspath(path), "rb").read() + def _rcs_duplicate_repo(self, directory, revision=None): + if revision == None: + RCS._rcs_duplicate_repo(self, directory, revision) + else: + status,output,error = \ + self._u_invoke_client("get", revision,directory) + def _rcs_commit(self, commitfile): + summary,body = self._u_parse_commitfile(commitfile) + #status,output,error = self._invoke_client("make-log") + if body == None: + status,output,error \ + = self._invoke_client("commit","--summary",summary) + else: + status,output,error \ + = self._invoke_client("commit","--summary",summary, + "--log-message",body) + revision = None + revline = re.compile("[*] committed (.*)") + match = revline.search(output) + assert match != None, output+error + assert len(match.groups()) == 1 + revpath = match.groups()[0] + assert not " " in revpath, revpath + assert revpath.startswith(self._archive_project_name()+'--') + revision = revpath[len(self._archive_project_name()+'--'):] + return revpath class CantAddFile(Exception): def __init__(self, file): self.file = file Exception.__init__(self, "Can't automatically add file %s" % file) +class ArchTestCase(RCStestCase): + Class = Arch -def add_dir_rule(rule, dirname, root): - inv_filename = os.path.join(dirname, '.arch-inventory') - file(inv_filename, "ab").write(rule) - if os.path.realpath(inv_filename) not in list_added(root): - add_id(inv_filename, paranoid=False) - -def force_source(filename, root): - rule = "source %s\n" % rel_filename(filename, root) - add_dir_rule(rule, os.path.dirname(filename), root) - if os.path.realpath(filename) not in list_added(root): - raise CantAddFile(filename) - -def add_id(filename, paranoid=False): - invoke_client("add-id", filename) - root = tree_root(filename) - if paranoid and os.path.realpath(filename) not in list_added(root): - force_source(filename, root) - - -def delete_id(filename): - invoke_client("delete-id", filename) - -def test_helper(type): - t = temp_arch_tree(type) - dirname = os.path.join(t, ".boo") - return dirname, t - -def mkdir(path, paranoid=False): - """ - >>> import shutil - >>> dirname,t = test_helper("easy") - >>> mkdir(dirname, paranoid=False) - >>> assert os.path.realpath(dirname) in list_added(t) - >>> assert not os.path.exists(os.path.join(t, ".arch-inventory")) - >>> shutil.rmtree(t) - >>> dirname,t = test_helper("tricky") - >>> mkdir(dirname, paranoid=True) - >>> assert os.path.realpath(dirname) in list_added(t) - >>> assert os.path.exists(os.path.join(t, ".arch-inventory")) - >>> shutil.rmtree(t) - >>> dirname,t = test_helper("impossible") - >>> try: - ... mkdir(dirname, paranoid=True) - ... except CantAddFile, e: - ... print "Can't add file" - Can't add file - >>> shutil.rmtree(t) - """ - os.mkdir(path) - add_id(path, paranoid=paranoid) - -def set_file_contents(path, contents): - add = not os.path.exists(path) - file(path, "wb").write(contents) - if add: - add_id(path) - - -def path_in_reference(bug_dir, spec): - if spec is not None: - return invoke_client("file-find", bug_dir, spec).rstrip('\n') - return invoke_client("file-find", bug_dir).rstrip('\n') - - -def unlink(path): - try: - os.unlink(path) - delete_id(path) - except OSError, e: - if e.errno != 2: - raise - - -def detect(path): - """Detect whether a directory is revision-controlled using Arch""" - path = os.path.realpath(path) - old_path = None - while True: - if os.path.exists(os.path.join(path, "{arch}")): - return True - if path == old_path: - return False - old_path = path - path = os.path.join('..', path) - -def precommit(directory): - pass - -def commit(directory, summary, body=None): - pass - -def postcommit(directory): - pass - - -name = "Arch" +unitsuite = unittest.TestLoader().loadTestsFromTestCase(ArchTestCase) +suite = unittest.TestSuite([unitsuite, doctest.DocTestSuite()]) -- cgit From 23179f50092d91dbeab97ad2b88cdaadb79b615f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 21 Nov 2008 14:56:05 -0500 Subject: 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. --- libbe/arch.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 10 deletions(-) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index 8e7390d..b35a897 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -50,14 +50,6 @@ class Arch(RCS): if self._u_search_parent_directories(path, "{arch}") != None : return True return False - def _rcs_root(self, path): - if not os.path.isdir(path): - dirname = os.path.dirname(path) - else: - dirname = path - status,output,error = self._u_invoke_client("tree-root", dirname) - # get archive name... - return output.rstrip('\n') def _rcs_init(self, path): self._create_archive(path) self._create_project(path) @@ -121,11 +113,35 @@ class Arch(RCS): assert self._archive_name != None assert self._project_name != None return "%s/%s" % (self._archive_name, self._project_name) + def _adjust_naming_conventions(self, path): + """ + By default, Arch restricts source code filenames to + ^[_=a-zA-Z0-9].*$ + See + http://regexps.srparish.net/tutorial-tla/naming-conventions.html + Since our bug directory '.be' doesn't satisfy these conventions, + we need to adjust them. + + The conventions are specified in + project-root/{arch}/=tagging-method + """ + tagpath = os.path.join(path, "{arch}", "=tagging-method") + lines_out = [] + for line in file(tagpath, "rb"): + line.decode("utf-8") + if line.startswith("source "): + lines_out.append("source ^[._=a-zA-X0-9].*$\n") + else: + lines_out.append(line) + file(tagpath, "wb").write("".join(lines_out).encode("utf-8")) + def _add_project_code(self, path): # http://mwolson.org/projects/GettingStartedWithArch.html - # http://regexps.srparish.net/tutorial-tla/importing-first.html#Importing_the_First_Revision - self._u_invoke_client("init-tree", self._archive_project_name(), + # http://regexps.srparish.net/tutorial-tla/new-source.html + # http://regexps.srparish.net/tutorial-tla/importing-first.html + self._invoke_client("init-tree", self._project_name, directory=path) + self._adjust_naming_conventions(path) self._invoke_client("import", "--summary", "Began versioning", directory=path) def _rcs_cleanup(self): @@ -133,6 +149,40 @@ class Arch(RCS): 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) + else: + dirname = path + status,output,error = self._u_invoke_client("tree-root", dirname) + root = output.rstrip('\n') + + self._get_archive_project_name(root) + + return root + + def _get_archive_name(self, root): + status,output,error = self._u_invoke_client("archives") + lines = output.split('\n') + # e.g. output: + # jdoe@example.com--bugs-everywhere-auto-2008.22.24.52 + # /tmp/BEtestXXXXXX/rootdir + # (+ repeats) + for archive,location in zip(lines[::2], lines[1::2]): + if os.path.realpath(location) == os.path.realpath(root): + self._archive_name = archive + assert self._archive_name != None + + def _get_archive_project_name(self, root): + # get project names + status,output,error = self._u_invoke_client("tree-version", directory=root) + # e.g output + # jdoe@example.com--bugs-everywhere-auto-2008.22.24.52/be--mainline--0.1 + 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: status,output,error = self._u_invoke_client('my-id') -- cgit From 6d4785e75e1552b3f04b1499fede6fdef2732c39 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 22 Nov 2008 16:15:16 -0500 Subject: Created and fixed bug 496edad5-1484-413a-bc68-4b01274a65eb. I figured out why Arch was complaining. For non-Arch users, file system access has been tweaked a bit see the BugDir doc string for details. Also, you should now set BugDir.rcs instead of .rcs_name. .rcs_name automatically tracks changes in .rcs (the reverse of the previous situation), so read from whichever you like. --- libbe/arch.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index b35a897..6415cef 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -21,7 +21,11 @@ import re import unittest import doctest +import traceback +import sys + import config +from beuuid import uuid_gen from rcs import RCS, RCStestCase, CommandError client = config.get_val("arch_client") @@ -54,6 +58,10 @@ 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 @@ -62,13 +70,13 @@ class Arch(RCS): name, email = self._u_parse_id(id) if email == None: email = "%s@example.com" % name - trailer = "%s-%s" % ("bugs-everywhere-auto", - time.strftime("%Y.%H.%M.%S")) + trailer = "%s-%s" % ("bugs-everywhere-auto", uuid_gen()[0:8]) self._archive_name = "%s--%s" % (email, trailer) self._archive_dir = "/tmp/%s" % trailer self._tmp_archive = True self._u_invoke_client("make-archive", self._archive_name, self._archive_dir, directory=path) + self._u_invoke_client("archives") def _invoke_client(self, *args, **kwargs): """ Invoke the client on our archive. @@ -145,11 +153,16 @@ 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) @@ -185,6 +198,7 @@ class Arch(RCS): def _rcs_get_user_id(self): try: + self._u_invoke_client("archives") status,output,error = self._u_invoke_client('my-id') return output.rstrip('\n') except Exception, e: @@ -195,11 +209,13 @@ class Arch(RCS): def _rcs_set_user_id(self, value): self._u_invoke_client('my-id', value) def _rcs_add(self, path): + self._u_invoke_client("archives") self._u_invoke_client("add-id", path) realpath = os.path.realpath(self._u_abspath(path)) pathAdded = realpath in self._list_added(self.rootdir) if self.paranoid and not pathAdded: self._force_source(path) + self._u_invoke_client("archives") def _list_added(self, root): assert os.path.exists(root) assert os.access(root, os.X_OK) @@ -243,13 +259,16 @@ class Arch(RCS): def _rcs_commit(self, commitfile): summary,body = self._u_parse_commitfile(commitfile) #status,output,error = self._invoke_client("make-log") + self._u_invoke_client("tree-root") + self._u_invoke_client("tree-version") + self._u_invoke_client("archives") if body == None: status,output,error \ - = self._invoke_client("commit","--summary",summary) + = self._u_invoke_client("commit","--summary",summary) else: status,output,error \ - = self._invoke_client("commit","--summary",summary, - "--log-message",body) + = self._u_invoke_client("commit","--summary",summary, + "--log-message",body) revision = None revline = re.compile("[*] committed (.*)") match = revline.search(output) -- cgit From 4a626e67b3f401b8e242a55571a802147123a196 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 22 Nov 2008 19:45:37 -0500 Subject: 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 --- libbe/arch.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'libbe/arch.py') 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") -- cgit From 9e0a846ff4fdaac45665e5a1e085aa37e3fa135b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 23 Nov 2008 06:51:30 -0500 Subject: Added archive/project init code for `./test_usage.sh arch`. Also some minor cleanups. --- libbe/arch.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index ba341e6..fd953a4 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -69,7 +69,6 @@ class Arch(RCS): self._tmp_archive = True self._u_invoke_client("make-archive", self._archive_name, self._archive_dir, directory=path) - self._u_invoke_client("archives") def _invoke_client(self, *args, **kwargs): """ Invoke the client on our archive. @@ -191,7 +190,6 @@ class Arch(RCS): self._project_name = project_name def _rcs_get_user_id(self): try: - self._u_invoke_client("archives") status,output,error = self._u_invoke_client('my-id') return output.rstrip('\n') except Exception, e: @@ -202,13 +200,11 @@ class Arch(RCS): def _rcs_set_user_id(self, value): self._u_invoke_client('my-id', value) def _rcs_add(self, path): - self._u_invoke_client("archives") self._u_invoke_client("add-id", path) realpath = os.path.realpath(self._u_abspath(path)) pathAdded = realpath in self._list_added(self.rootdir) if self.paranoid and not pathAdded: self._force_source(path) - self._u_invoke_client("archives") def _list_added(self, root): assert os.path.exists(root) assert os.access(root, os.X_OK) @@ -252,9 +248,6 @@ class Arch(RCS): def _rcs_commit(self, commitfile): summary,body = self._u_parse_commitfile(commitfile) #status,output,error = self._invoke_client("make-log") - self._u_invoke_client("tree-root") - self._u_invoke_client("tree-version") - self._u_invoke_client("archives") if body == None: status,output,error \ = self._u_invoke_client("commit","--summary",summary) -- cgit