Also a few minor tweaks to the module imports.
severity: minor
-status: open
+status: fixed
summary: Add docstrings explaining role of the libbe submodules.
RM = rm
-#PREFIX = /usr/local
-PREFIX = ${HOME}
+PREFIX = /usr/local
+#PREFIX = ${HOME}
INSTALL_OPTIONS = "--prefix=${PREFIX}"
\f
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+GNU Arch (tla) backend.
+"""
+
import codecs
import os
import re
import unittest
import doctest
-import config
from beuuid import uuid_gen
+import config
import vcs
-from vcs import VCS
+
+
DEFAULT_CLIENT = "tla"
def new():
return Arch()
-class Arch(VCS):
+class Arch(vcs.VCS):
name = "Arch"
client = client
versioned = True
pass
def _vcs_get_file_contents(self, path, revision=None, binary=False):
if revision == None:
- return VCS._vcs_get_file_contents(self, path, revision, binary=binary)
+ return vcs.VCS._vcs_get_file_contents(self, path, revision, binary=binary)
else:
status,output,error = \
self._invoke_client("file-find", path, revision)
return contents
def _vcs_duplicate_repo(self, directory, revision=None):
if revision == None:
- VCS._vcs_duplicate_repo(self, directory, revision)
+ vcs.VCS._vcs_duplicate_repo(self, directory, revision)
else:
status,output,error = \
self._u_invoke_client("get", revision,directory)
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
"""
Backwards compatibility support for Python 2.4. Once people give up
on 2.4 ;), the uuid call should be merged into bugdir.py
import unittest
+
try:
from uuid import uuid4 # Python >= 2.5
def uuid_gen():
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Define the Bug class for representing bugs.
+"""
+
import os
import os.path
import errno
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Define the BugDir class for representing bug comments.
+"""
+
import copy
import errno
import os
import upgrade
import utility
+
class NoBugDir(Exception):
def __init__(self, path):
msg = "The directory \"%s\" has no bug directory." % path
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Bazaar (bzr) backend.
+"""
+
import os
import re
import sys
import doctest
import vcs
-from vcs import VCS
+
def new():
return Bzr()
-class Bzr(VCS):
+class Bzr(vcs.VCS):
name = "bzr"
client = "bzr"
versioned = True
pass
def _vcs_get_file_contents(self, path, revision=None, binary=False):
if revision == None:
- return VCS._vcs_get_file_contents(self, path, revision, binary=binary)
+ return vcs.VCS._vcs_get_file_contents(self, path, revision, binary=binary)
else:
status,output,error = \
self._u_invoke_client("cat","-r",revision,path)
return output
def _vcs_duplicate_repo(self, directory, revision=None):
if revision == None:
- VCS._vcs_duplicate_repo(self, directory, revision)
+ vcs.VCS._vcs_duplicate_repo(self, directory, revision)
else:
self._u_invoke_client("branch", "--revision", revision,
".", directory)
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Define assorted utilities to make command-line handling easier.
+"""
+
import glob
import optparse
import os
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Define the Comment class for representing bug comments.
+"""
+
import base64
import os
import os.path
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Create, save, and load the per-user config file at path().
+"""
+
import ConfigParser
import codecs
import locale
import sys
import doctest
+
default_encoding = sys.getfilesystemencoding() or locale.getpreferredencoding()
def path():
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Darcs backend.
+"""
+
import codecs
import os
import re
import unittest
import vcs
-from vcs import VCS
+
def new():
return Darcs()
-class Darcs(VCS):
+class Darcs(vcs.VCS):
name="darcs"
client="darcs"
versioned=True
pass # darcs notices changes
def _vcs_get_file_contents(self, path, revision=None, binary=False):
if revision == None:
- return VCS._vcs_get_file_contents(self, path, revision,
+ return vcs.VCS._vcs_get_file_contents(self, path, revision,
binary=binary)
else:
try:
status,output,error = self._u_invoke(args, stdin=target_patch)
if os.path.exists(os.path.join(self.rootdir, path)) == True:
- contents = VCS._vcs_get_file_contents(self, path,
+ contents = vcs.VCS._vcs_get_file_contents(self, path,
binary=binary)
else:
contents = ""
status,output,error = self._u_invoke(args, stdin=target_patch)
args=["patch", path]
status,output,error = self._u_invoke(args, stdin=major_patch)
- current_contents = VCS._vcs_get_file_contents(self, path,
+ current_contents = vcs.VCS._vcs_get_file_contents(self, path,
binary=binary)
return contents
def _vcs_duplicate_repo(self, directory, revision=None):
if revision==None:
- VCS._vcs_duplicate_repo(self, directory, revision)
+ vcs.VCS._vcs_duplicate_repo(self, directory, revision)
else:
self._u_invoke_client("put", "--to-patch", revision, directory)
def _vcs_commit(self, commitfile, allow_empty=False):
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-"""Compare two bug trees"""
-from libbe import bugdir, bug, settings_object, tree
-from libbe.utility import time_to_str
+
+"""Compare two bug trees."""
+
import difflib
import doctest
+from libbe import bugdir, bug, settings_object, tree
+from libbe.utility import time_to_str
+
+
class DiffTree (tree.Tree):
"""
A tree holding difference data for easy report generation.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Define editor_string(), a function that invokes an editor to accept
+user-produced text as a string.
+"""
+
import codecs
import locale
import os
import tempfile
import doctest
+
default_encoding = sys.getfilesystemencoding() or locale.getpreferredencoding()
comment_marker = u"== Anything below this line will be ignored\n"
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Support input/output/filesystem encodings (e.g. UTF-8).
+"""
+
import codecs
import locale
import sys
import doctest
+
ENCODING = None # override get_encoding() output by setting this
def get_encoding():
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Git backend.
+"""
+
import os
import re
import sys
import doctest
import vcs
-from vcs import VCS
+
def new():
return Git()
-class Git(VCS):
+class Git(vcs.VCS):
name="git"
client="git"
versioned=True
self._vcs_add(path)
def _vcs_get_file_contents(self, path, revision=None, binary=False):
if revision == None:
- return VCS._vcs_get_file_contents(self, path, revision, binary=binary)
+ return vcs.VCS._vcs_get_file_contents(self, path, revision, binary=binary)
else:
arg = "%s:%s" % (revision,path)
status,output,error = self._u_invoke_client("show", arg)
return output
def _vcs_duplicate_repo(self, directory, revision=None):
if revision==None:
- VCS._vcs_duplicate_repo(self, directory, revision)
+ vcs.VCS._vcs_duplicate_repo(self, directory, revision)
else:
#self._u_invoke_client("archive", revision, directory) # makes tarball
self._u_invoke_client("clone", "--no-checkout",".",directory)
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Mercurial (hg) backend.
+"""
+
import os
import re
import sys
import doctest
import vcs
-from vcs import VCS
+
def new():
return Hg()
-class Hg(VCS):
+class Hg(vcs.VCS):
name="hg"
client="hg"
versioned=True
pass
def _vcs_get_file_contents(self, path, revision=None, binary=False):
if revision == None:
- return VCS._vcs_get_file_contents(self, path, revision, binary=binary)
+ return vcs.VCS._vcs_get_file_contents(self, path, revision, binary=binary)
else:
status,output,error = \
self._u_invoke_client("cat","-r",revision,path)
return output
def _vcs_duplicate_repo(self, directory, revision=None):
if revision == None:
- return VCS._vcs_duplicate_repo(self, directory, revision)
+ return vcs.VCS._vcs_duplicate_repo(self, directory, revision)
else:
self._u_invoke_client("archive", "--rev", revision, directory)
def _vcs_commit(self, commitfile, allow_empty=False):
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import yaml
-import os.path
+
+"""
+Provide a means of saving and loading dictionaries of parameters. The
+saved "mapfiles" should be clear, flat-text files, and allow easy merging of
+independent/conflicting changes.
+"""
+
import errno
-import utility
+import os.path
+import yaml
import doctest
+
class IllegalKey(Exception):
def __init__(self, key):
Exception.__init__(self, 'Illegal key "%s"' % key)
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Allow simple listing and loading of the various becommands and libbe
+submodules (i.e. "plugins").
+"""
+
import os
import os.path
import sys
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Define a traversable tree structure.
+"""
+
import doctest
class Tree(list):
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Assorted utility functions that don't fit in anywhere else.
+"""
+
import calendar
import codecs
import os
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Define the base VCS (Version Control System) class, which should be
+subclassed by other Version Control System backends. The base class
+implements a "do not version" VCS.
+"""
+
from subprocess import Popen, PIPE
import codecs
import os