Пример #1
0
 def save(self):
     """ Save attributes of the repositories to disk. """
     userRepositoryListDict = {}
     for name, repository in self.userRepositories.iteritems():
         userRepositoryListDict[name] = {}
         userRepositoryListDict[name][
             "git-origin"] = repository.getGitOriginURI()
         userRepositoryListDict[name]["temporary"] = repository.isTemporary(
         )
     with open(self.userRepositoryListPath, 'w') as file_f:
         json.dump(userRepositoryListDict,
                   file_f,
                   indent=1,
                   separators=(',', ': '))
     repositoryStatesDotJsonPath = os.path.join(
         self.getUser().getConfig().getRegistryPath(),
         "repository-states.json")
     repositoryStates = {}
     for repoName, repository in self.iteritems():
         repositoryStates[repoName] = {}
         repositoryStates[repoName][
             "git-commit-hash"] = repository.getGitCommitHash()
     with open(repositoryStatesDotJsonPath,
               mode="w") as repositoryStatesDotJsonFile:
         json.dump(repositoryStates,
                   repositoryStatesDotJsonFile,
                   indent=1,
                   separators=(',', ': '))
Пример #2
0
def lookupRepositoryByURI(user,uri):
  """
  If a repository with this URI exists, return that repository.  Otherwise, return None.
  """
  for _,repository in user.getRegistry().getRepositories().items():
    if uri == repository.getGitOriginURI():
      return repository
  return None
Пример #3
0
def lookupRepositoryByURI(user, uri):
    """
  If a repository with this URI exists, return that repository.  Otherwise, return None.
  """
    for _, repository in user.getRegistry().getRepositories().iteritems():
        if uri == repository.getGitOriginURI():
            return repository
    return None
Пример #4
0
 def addRepository(self, repository):
     if not repository.isTemporary():
         self.getUser().getRegistry().logChange("Adding new repository " +
                                                repository.getName())
     else:
         self.getUser().getRegistry().logChange(
             "Adding new temporary repository " +
             repository.getGitOriginURI())
     self.userRepositories[repository.getName()] = repository
Пример #5
0
  def save(self):
    """
    Save attributes of the repositories to disk.

    Note: This is done automatically for you when you ``commit()`` the registry.
    """
    userRepositoryListDict = {}
    for name,repository in self.userRepositories.items():
      userRepositoryListDict[name] = {}
      if repository.getGitOriginURI():
        userRepositoryListDict[name]["git-origin"] = repository.getGitOriginURI()
      else:
        userRepositoryListDict[name]["source-dir"] = repository.getRepoPath()
      userRepositoryListDict[name]["temporary"] = repository.isTemporary()
    with open(self.userRepositoryListPath, 'w') as file_f:
      json.dump(userRepositoryListDict, file_f, indent=1, separators=(',', ': '))
    repositoryStatesDotJsonPath = os.path.join(self.getUser().getConfig()["registry-dir"],"repository-states.json")
    repositoryStates = {}
    for repoName,repository in self.items():
      repositoryStates[repoName] = {}
      repositoryStates[repoName]["git-commit-hash"] = repository.getGitCommitHash()
    with open(repositoryStatesDotJsonPath,mode="w") as repositoryStatesDotJsonFile:
      json.dump(repositoryStates,repositoryStatesDotJsonFile, indent=1, separators=(',', ': '))
Пример #6
0
 def save(self):
   """ Save attributes of the repositories to disk. """
   userRepositoryListDict = {}
   for name,repository in self.userRepositories.iteritems():
     userRepositoryListDict[name] = {}
     userRepositoryListDict[name]["git-origin"] = repository.getGitOriginURI()
   with open(self.userRepositoryListPath, 'w') as file_f:
     json.dump(userRepositoryListDict, file_f, indent=1, separators=(',', ': '))
   repositoryStatesDotJsonPath = os.path.join(self.getUser().getConfig().getRegistryPath(),"repository-states.json")
   repositoryStates = {}
   for repoName,repository in self.iteritems():
     repositoryStates[repoName] = {}
     repositoryStates[repoName]["git-commit-hash"] = repository.getGitCommitHash()
   with open(repositoryStatesDotJsonPath,mode="w") as repositoryStatesDotJsonFile:
     json.dump(repositoryStates,repositoryStatesDotJsonFile, indent=1, separators=(',', ': '))
Пример #7
0
    def save(self):
        """
    Save attributes of the repositories to disk.

    Note: This is done automatically for you when you ``commit()`` the registry.
    """
        userRepositoryListDict = {}
        for name, repository in self.userRepositories.items():
            userRepositoryListDict[name] = {}
            if repository.getGitOriginURI():
                userRepositoryListDict[name][
                    "git-origin"] = repository.getGitOriginURI()
            else:
                userRepositoryListDict[name][
                    "source-dir"] = repository.getRepoPath()
            userRepositoryListDict[name]["temporary"] = repository.isTemporary(
            )
        with open(self.userRepositoryListPath, 'w') as file_f:
            json.dump(userRepositoryListDict,
                      file_f,
                      indent=1,
                      separators=(',', ': '))
        repositoryStatesDotJsonPath = os.path.join(
            self.getUser().getConfig()["registry-dir"],
            "repository-states.json")
        repositoryStates = {}
        for repoName, repository in self.items():
            repositoryStates[repoName] = {}
            repositoryStates[repoName][
                "git-commit-hash"] = repository.getGitCommitHash()
        with open(repositoryStatesDotJsonPath,
                  mode="w") as repositoryStatesDotJsonFile:
            json.dump(repositoryStates,
                      repositoryStatesDotJsonFile,
                      indent=1,
                      separators=(',', ': '))
Пример #8
0
 def addRepository(self,repository):
   if not type(repository.getName()) is int:
     self.getUser().getRegistry().logChange("Adding new repository "+repository.getName())
   else:
     self.getUser().getRegistry().logChange("Adding new temporary repository "+repository.getGitOriginURI())
   self.userRepositories[repository.getName()] = repository