Upgrade to Pro — share decks privately, control downloads, hide ads and more …

gitfs

 gitfs

gitfs is a FUSE file system that fully integrates with git. You can mount a remote repository's branch locally, and any subsequent changes made to the files will be automatically committed to the remote.

Vlad Temian

February 26, 2015
Tweet

More Decks by Vlad Temian

Other Decks in Programming

Transcript

  1. gitfs - Pytim #7 from pygit2 import clone_repository, Keypair credentials

    = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "")
  2. gitfs - Pytim #7 from pygit2 import clone_repository, Keypair credentials

    = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials)
  3. gitfs - Pytim #7 from pygit2 import clone_repository, Keypair credentials

    = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials) remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials
  4. gitfs - Pytim #7 from pygit2 import clone_repository, Keypair credentials

    = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "") repository = clone_repository("git@github. com:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials) remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials remote[0].push("refs/heads/master")
  5. gitfs - Pytim #7 class Memory(Operations): def open(self, path, flags):

    self.fd += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size]
  6. gitfs - Pytim #7 class Memory(Operations): def open(self, path, flags):

    self.fd += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old)
  7. gitfs - Pytim #7 class Memory(Operations): def open(self, path, flags):

    self.fd += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old) def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1
  8. gitfs - Pytim #7 class Memory(Operations): def open(self, path, flags):

    self.fd += 1 return self.fd def read(self, path, size, offset, fh): return self.data[path][offset:offset + size] def rename(self, old, new): self.files[new] = self.files.pop(old) def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1 def write(self, path, data, offset, fh): self.data[path] = self.data[path][:offset] +data self.files[path]['st_size'] = len(self.data[path]) return len(data)
  9. gitfs - Pytim #7 very dirty def rename(self, old, new):

    if "history" in old or new: # raise EROFS elif old == "/" or new == "/": # raise EROFS else: # do the actual rename
  10. gitfs - Pytim #7 solve conflicts 1 2 3 4

    5 6 merging_remote 1 2 3 7 8 merging_local
  11. gitfs - Pytim #7 1 2 3 4 5 7'

    6 8' local solve conflicts
  12. gitfs - Pytim #7 want to sync don't open for

    write Commit queue Sync worker commits Fuse threads
  13. gitfs - Pytim #7 commit want to sync don't open

    for write Commit queue Sync worker commits Fuse threads
  14. gitfs - Pytim #7 commit sync done want to sync

    don't open for write Commit queue Fetch worker Sync worker fetch fetch fetch commits Fuse threads
  15. gitfs - Pytim #7 $ sudo add-apt-repository ppa:presslabs/gitfs $ sudo

    apt-get update $ sudo apt-get install gitfs