Exemple #1
0
def storeuntracked(repo, untracked):
    if not untracked:
        return
    os.mkdir(repo.join('tasks/untrackedbackup'))
    for f in untracked:
        shaname = util.sha1(f).hexdigest()
        util.copyfile(util.pathto(repo.root, None, f),
                      repo.join('tasks/untrackedbackup/%s' % shaname))
        util.unlink(util.pathto(repo.root, None, f))
Exemple #2
0
def storeuntracked(repo, untracked):
    if not untracked:
        return
    os.mkdir(repo.join('tasks/untrackedbackup'))
    for f in untracked:
        shaname = util.sha1(f).hexdigest()
        util.copyfile(util.pathto(repo.root, None, f),
            repo.join('tasks/untrackedbackup/%s' % shaname))
        util.unlink(util.pathto(repo.root, None, f))
Exemple #3
0
 def pathto(self, f, cwd=None):
     if cwd is None:
         cwd = self.getcwd()
     # TODO core dirstate does something about slashes here
     assert isinstance(f, bytes)
     r = util.pathto(self._root, cwd, f)
     return r
Exemple #4
0
def filesha(repo, file):
    '''returns a sha1 of file contents'''
    f = util.pathto(repo.root, None, file)
    if os.path.exists(f):
        contents = open(f).read()
    else:
        contents = ''
    return util.sha1(contents).hexdigest()
Exemple #5
0
def filesha(repo, file):
    '''returns a sha1 of file contents'''
    f = util.pathto(repo.root, None, file)
    if os.path.exists(f):
        contents = open(f).read()
    else:
        contents = '';
    return util.sha1(contents).hexdigest()
Exemple #6
0
def restoreuntracked(repo, untracked):
    for f in untracked:
        shaname = util.sha1(f).hexdigest()
        util.copyfile(repo.join('tasks/untrackedbackup/%s' % shaname),
                      util.pathto(repo.root, None, f))
Exemple #7
0
def restoreuntracked(repo, untracked):
    for f in untracked:
        shaname = util.sha1(f).hexdigest()
        util.copyfile(repo.join('tasks/untrackedbackup/%s' % shaname),
            util.pathto(repo.root, None, f))