def _remote_path(self, relpath): """After connecting, HTTP Transport only deals in relative URLs.""" # Adjust the relpath based on which URL this smart transport is # connected to. http_base = urlutils.normalize_url(self.get_smart_medium().base) url = urlutils.join(self.base[len('bzr+'):], relpath) url = urlutils.normalize_url(url) return urlutils.relative_url(http_base, url)
def apply(self, bzrdir, stacked_on_url): branch = bzrdir.open_branch() # it may be a path relative to the cwd or a url; the branch wants # a path relative to itself... on_url = urlutils.relative_url(branch.base, urlutils.normalize_url(stacked_on_url)) branch.lock_write() try: branch.set_stacked_on_url(on_url) if not trace.is_quiet(): ui.ui_factory.note(gettext( "{0} is now stacked on {1}\n").format( branch.base, branch.get_stacked_on_url())) finally: branch.unlock()
def run(self, *args, **kwargs): location = None if kwargs.has_key('location'): location = kwargs['location'] if kwargs.has_key('verbose') and kwargs['verbose']: noise_level = 2 else: noise_level = 0 from infoxml import show_bzrdir_info_xml if location != None: from bzrlib.urlutils import normalize_url location = normalize_url(location) show_bzrdir_info_xml(bzrdir.BzrDir.open_containing(location)[0], verbose=noise_level, outfile=self.outf) if getattr(kwargs, 'null', False): self.outf.write('\0') self.outf.write('\n')
def create_items(self): from bzrlib import errors item = gtk.CheckMenuItem('_Gateway to LAN') item.connect('toggled', self.toggle_lan_gateway) self.append(item) self.append(gtk.SeparatorMenuItem()) try: from bzrlib.plugins.dbus.activity import LanGateway self.langateway = LanGateway() except ImportError: item.set_sensitive(False) except errors.BzrError: # FIXME: Should only catch errors that indicate a lan-notify # process is already running. item.set_sensitive(False) item = gtk.CheckMenuItem('Announce _branches on LAN') item.connect('toggled', self.toggle_announce_branches) self.append(item) self.append(gtk.SeparatorMenuItem()) try: from bzrlib.plugins.avahi.share import ZeroConfServer from bzrlib import urlutils self.zeroconfserver = ZeroConfServer(urlutils.normalize_url('.')) except ImportError: item.set_sensitive(False) item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None) item.connect('activate', self.show_preferences) self.append(item) item = gtk.ImageMenuItem(gtk.STOCK_ABOUT, None) item.connect('activate', self.show_about) self.append(item) self.append(gtk.SeparatorMenuItem()) item = gtk.ImageMenuItem(gtk.STOCK_QUIT, None) item.connect('activate', gtk.main_quit) self.append(item) self.show_all()