Giter Site home page Giter Site logo

reactivegit's Introduction

ReactiveGit

This is an experiment in combining Rx and LibGit2Sharp to create an API to make git operations friendly for asynchronous situations.

libgit2 operations are, by their nature, synchronous. This is reflected in the wrapper APIs such as LibGit2Sharp. This is great for simple interactions with repositories, but working with complex tasks against large repositories requires embracing asynchrony and pushing operations onto background threads.

Rather than create a duplicate set of asynchronous APIs for LibGit2Sharp, this project is intending to represent specific Git actions as a thing which can be observed. Many operations support cancellation, and this can be handled in ReactiveGit by simply disposing of the subscription to an observable action.

The other focus of this framework is around progress handlers, which LibGit2Sharp added support for recently. This enables a user to specify a callbacks to events in libgit2. By passing an observer to the operation in ReactiveGit, you can receive progress information in real-time to display in your application.

Installation

Install the package from NuGet!

Install-Package ReactiveGit

Examples

// many operations require authentication
CredentialsHandler credentials = (url, usernameFromUrl, types) =>
    new UsernamePasswordCredentials
    {
        Username = "shiftkey-tester",
        Password = "haha-password"
    };


// you can also pass an existing LibGit2Sharp repository here
var repository = new ObservableRepository(
  @"C:\Users\brendanforster\Documents\GìtHūb\testing-pushspecs",
  credentials);

// specify a progress observer to report progress
var pullObserver = new ReplaySubject<Tuple<string, int>>();
pullObserver.Subscribe(
  next => Console.WriteLine("Progress: " + next.Item2));

// execute the operation
var pullResult = await repository.Pull(pullObserver);

Contributing

If you'd like to get involved, check out the CONTRIBUTING.md docs for more information.

reactivegit's People

Contributors

shiftkey avatar nulltoken avatar

Watchers

James Cloos avatar Lee Campbell avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.