def __init__(self, cwd=None): """Reads git repository settings and sets several methods so that they refer to the git module. This object encapsulates cola's interaction with git.""" ObservableModel.__init__(self) # Initialize the git command object self.git = git.instance() ##################################################### self.head = 'HEAD' self.mode = self.mode_none self.diff_text = '' self.filename = None self.currentbranch = '' self.trackedbranch = '' self.directory = '' self.git_version = self.git.version() self.remotes = [] self.remotename = '' self.local_branch = '' self.remote_branch = '' ##################################################### # Status info self.commitmsg = '' self.modified = [] self.staged = [] self.untracked = [] self.unmerged = [] self.upstream_changed = [] self.submodules = set() ##################################################### # Refs self.revision = '' self.local_branches = [] self.remote_branches = [] self.tags = [] self.revisions = [] self.summaries = [] self.fetch_helper = None self.push_helper = None self.pull_helper = None self.generate_remote_helpers() if cwd: self.use_worktree(cwd) ##################################################### # Dag self._commits = []
def save(self): """Saves settings to the .cola file""" # Call the base method ObservableModel.save(self, self.path())
def load(self): """Loads settings if they exist""" settings = self.path() if os.path.exists(settings): ObservableModel.load(self, settings)
def __init__(self): """Load existing settings if they exist""" ObservableModel.__init__(self) self.bookmarks = [] self.gui_state = {} self.load()
def __init__(self): ObservableModel.__init__(self) self.staged = [] self.modified = [] self.unmerged = [] self.untracked = []