# Ben Finney <benf@cybersource.com.au>
# Chris Ball <cjb@laptop.org>
# Gianluca Montecchi <gian@grys.it>
-# W. Trevor King <wking@drexel.edu>
+# W. Trevor King <wking@tremily.us>
#
# This file is part of Bugs Everywhere.
#
# You should have received a copy of the GNU General Public License along with
# Bugs Everywhere. If not, see <http://www.gnu.org/licenses/>.
-"""Define the base :class:`VCS` (Version Control System) class, which
+"""Define the base :py:class:`VCS` (Version Control System) class, which
should be subclassed by other Version Control System backends. The
base class implements a "do not version" VCS.
"""
"""
def set_preferred_vcs(name):
- """Manipulate :data:`VCS_ORDER` to place `name` first.
+ """Manipulate :py:data:`VCS_ORDER` to place `name` first.
This is primarily indended for testing purposes.
"""
def _get_matching_vcs(matchfn):
"""Return the first module for which matchfn(VCS_instance) is True.
- Searches in :data:`VCS_ORDER`.
+ Searches in :py:data:`VCS_ORDER`.
"""
for submodname in VCS_ORDER:
module = import_by_name('libbe.storage.vcs.%s' % submodname)
def vcs_by_name(vcs_name):
"""Return the module for the VCS with the given name.
- Searches in :data:`VCS_ORDER`.
+ Searches in :py:data:`VCS_ORDER`.
"""
if vcs_name == VCS.name:
return new()
def detect_vcs(dir):
"""Return an VCS instance for the vcs being used in this directory.
- Searches in :data:`VCS_ORDER`.
+ Searches in :py:data:`VCS_ORDER`.
"""
return _get_matching_vcs(lambda vcs: vcs._detect(dir))
def installed_vcs():
"""Return an instance of an installed VCS.
- Searches in :data:`VCS_ORDER`.
+ Searches in :py:data:`VCS_ORDER`.
"""
return _get_matching_vcs(lambda vcs: vcs.installed())
.../.be/BUGDIR/bugs/BUG/comments/COMMENT
^-- root path
- See :mod:`libbe.util.id` for a discussion of ID formats.
+ See :py:mod:`libbe.util.id` for a discussion of ID formats.
Examples
--------
self._cache_path = os.path.join(
self._root, self._spacer_dirs[0], 'id-cache')
- def init(self, verbose=True, cache=None):
+ def init(self, cache=None):
"""Create cache file for an existing .be directory.
The file contains multiple lines of the form::
else:
self._cache = cache
spaced_root = os.path.join(self._root, self._spacer_dirs[0])
- for dirpath, dirnames, filenames in os.walk(spaced_root):
+ for dirpath, dirnames, filenames in os.walk(spaced_root,
+ followlinks=True):
if dirpath == spaced_root:
continue
try:
id = self.id(dirpath)
relpath = dirpath[len(self._root + os.path.sep):]
if id.count('/') == 0:
- if verbose == True and id in self._cache:
- print >> sys.stderr, 'Multiple paths for %s: \n %s\n %s' % (id, self._cache[id], relpath)
+ if id in self._cache:
+ libbe.LOG.warning(
+ 'multiple paths for {0}:\n {1}\n {2}'.format(
+ id, self._cache[id], relpath))
self._cache[id] = relpath
except InvalidPath:
pass
else:
extra = fields[1:]
if uuid not in self._cache:
- self.init(verbose=False, cache=self._cache)
+ self.init(cache=self._cache)
if uuid not in self._cache:
raise InvalidID(uuid)
if relpath == True:
libbe.storage.base.VersionedStorage.__init__(self, *args, **kwargs)
self.versioned = False
self.interspersed_vcs_files = False
- self.verbose_invoke = False
self._cached_path_id = CachedPathID()
self._rooted = False
def _u_invoke(self, *args, **kwargs):
if 'cwd' not in kwargs:
kwargs['cwd'] = self.repo
- if 'verbose' not in kwargs:
- kwargs['verbose'] = self.verbose_invoke
if 'encoding' not in kwargs:
kwargs['encoding'] = self.encoding
return invoke(*args, **kwargs)
return relpath
def _u_abspath(self, path, root=None):
- """Return the absolute path from a path realtive to root.
+ """Return the absolute path from a path relative to root.
Examples
--------
See Also
--------
- :mod:`libbe.storage.util.upgrade`
+ libbe.storage.util.upgrade
"""
if path == None:
path = os.path.join(self.repo, '.be', 'version')
class VCS_get_user_id_TestCase(VCSTestCase):
"""Test cases for VCS.get_user_id method."""
- def test_gets_existing_user_id(self):
+ def test_get_existing_user_id(self):
"""Should get the existing user ID."""
if self.s.installed():
user_id = self.s.get_user_id()