def unfollow(self, mess, args): """ Unfollow the given git repository url or specific heads The first argument is the url. The next optional arguments are the heads to unfollow. If no optional arguments are given, just unfollow the repo completely """ admin_only(mess) args = args.strip().split(' ') if len(args) < 1: return 'You need a parameter' human_name = str(args[0]) heads_to_unfollow = args[1:] if len(args) > 1 else None with self.ggl: if not self.shelf.has_key(human_name): return 'I cannot find %s repos' % human_name if heads_to_unfollow: self.shelf[human_name] = [ (head, sha) for head, sha in self.shelf[human_name] if head not in heads_to_unfollow ] self.shelf.sync() return 'Heads %s have been removed from %s' % (','.join( heads_to_unfollow), human_name) + '\n\n' + self.following( None, None) remove_repo(human_name) del (self.shelf[human_name]) self.shelf.sync() return ('%s has been removed.' % human_name) + '\n\n' + self.following(None, None)
def unfollow(self, mess, args): """ Unfollow the given git repository url or specific heads The first argument is the url. The next optional arguments are the heads to unfollow. If no optional arguments are given, just unfollow the repo completely """ admin_only(mess) args = args.strip().split(' ') if len(args) < 1: return 'You need a parameter' human_name = str(args[0]) heads_to_unfollow = args[1:] if len(args) > 1 else None with self.ggl: if not self.shelf.has_key(human_name): return 'I cannot find %s repos' % human_name if heads_to_unfollow: self.shelf[human_name] = [(head, sha) for head, sha in self.shelf[human_name] if head not in heads_to_unfollow] self.shelf.sync() return 'Heads %s have been removed from %s' % (','.join(heads_to_unfollow), human_name) + '\n\n' + self.following(None, None) remove_repo(human_name) del(self.shelf[human_name]) self.shelf.sync() return ('%s has been removed.' % human_name) + '\n\n' + self.following(None, None)
def follow(self, mess, args): """ Follow the given git repository url and be notified when somebody commits something on it The first argument is the git url. The next optional arguments are the heads to follow. If no optional arguments are given, just follow all the heads You can alternatively put a name of a plugin or 'allplugins' to follow the changes of the installed r2 plugins. """ admin_only(mess) args = args.strip().split(' ') if len(args) < 1: return 'You need at least a parameter' git_name = args[0] result = '' installed_plugin_repos = self.get_installed_plugin_repos() if git_name == 'allplugins': for url in [ url for name, url in installed_plugin_repos.iteritems() ]: result = self._git_follow_url(url, None) # follow everything return result elif git_name in installed_plugin_repos: git_name = installed_plugin_repos[ git_name] # transform the symbolic name to the url heads_to_follow = args[1:] if len(args) > 1 else None return self._git_follow_url(git_name, heads_to_follow)
def follow(self, mess, args): """ Follow the given git repository url and be notified when somebody commits something on it The first argument is the git url. The next optional arguments are the heads to follow. If no optional arguments are given, just follow all the heads You can alternatively put a name of a plugin or 'allplugins' to follow the changes of the installed r2 plugins. """ admin_only(mess) args = args.strip().split(' ') if len(args) < 1: return 'You need at least a parameter' git_name = args[0] result = '' installed_plugin_repos = self.get_installed_plugin_repos() if git_name == 'allplugins': for url in [url for name, url in installed_plugin_repos.iteritems()]: result = self._git_follow_url(url, None) # follow everything return result elif git_name in installed_plugin_repos: git_name = installed_plugin_repos[git_name] # transform the symbolic name to the url heads_to_follow = args[1:] if len(args) > 1 else None return self._git_follow_url(git_name, heads_to_follow)