Coder Social home page Coder Social logo

emacsmirror / vc-partial-commit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fperrin/vc-partial-commit

1.0 2.0 0.0 19 KB

Commit only some changes from a diff

Home Page: https://github.com/fperrin/vc-partial-commit

License: GNU General Public License v3.0

Emacs Lisp 100.00%

vc-partial-commit's Introduction

vc-partial-commit – faire un commit partiel

In English

Description

The idea is that after some happy hacking on a file, there are several unrelated changes in our working copy. For instance, while working on feature A, we hit bug B, so we corrected it before continuing to work on A. But, we want to commit “atomic changes” (e.g. only the correction to B, and then the new feature A), so we want to commit only part of thoses changes (as in ”git add --patch”). So, we ask for the diff between our working copy and the last updated file, we keep only those hunks we want to keep, and commit that. And then we can make a second commit with the rest of the changes.

Since this package uses only Emacs’ high-level VC commands, this feature is available to all VCS supported by Emacs.

Usage

When you are about to commit changes, press C-x v = (from a *vc-dir* buffer after marking some files, or directly from a file). This will bring up a *vc-diff* buffer in diff-mode. Edit the diff (k to delete a hunk, C-c C-s to split a hunk, etc.). When satisfied, press C-x v p, enter a comment in the buffer, and C-c C-c to commit the buffer.

You can actually use C-x v p from any buffer in diff-mode, as long as the filenames in the patch are relative to the patch location.

When not visiting a buffer in diff-mode, C-x v p will invoke (vc-diff nil).

Installation

The code is kept in my SVN repository, with a git mirror available. Retreive the .el file and put it somewhere in your =load-path=. Add (require 'vc-partial-commit) to your .emacs.

Bugs

There is no checking that the patch you created while in diff-mode will apply. If it doesn’t, your working copy is going to be left in some intermediate state. In order to recover from that situation, run vc-partial-commit-restore-working-file. Maybe such situations should be detected and handled from vc-partial-commit itself.

Maybe we should register vc-partial-commit as a potential action in vc-next-action.

En Français

Description

Après une séance de code, il peut y avoir plusieurs modifications qui n’ont pas de rapport entre elles qui sont mélangées dans la copie locale. Typiquement, pendant que l’on travaille sur la fonctionnalité A, on tombe sur le bogue B, que l’on corrige. On voudrait ne committer que la correction de B, indépendemment de A, un peu à là git add --patch. On demande le diff entre notre copie de travail et le dernier commit, on ne garde que les morceaux qui nous intéressent, on committe cela. Ensuite, on peut faire un deuxième commit avec le reste des modifications.

Ce paquet n’utilisant que les commandes de VC d’Emacs, cette fonctionnalité est disponible dans tous les VCS gérés par Emacs.

Utilisation

Utilisez C-x v = (depuis un tampon *vc-dir* après avoir sélectionné certains fichiers, ou directement depuis un fichier). Ceci va créer un tampon *vc-diff* en mode diff-mode. Éditez le diff (k pour supprimer un hunk, C-c C-s pour diviser un hunk en deux morceaux, etc.). Lorsque le patch à committer est prêt, utilisez C-x v p, entrez un commentaire dans le tampon *vc-log*, et C-c C-c pour valider.

En fait, on peut utiliser C-x v p depuis tout tampon qui est en mode diff-mode, à condition que les chemins dans le diff soient resolvables depuis le dossier contenant le patch.

Lorsqu’on visite un tampon qui n’est pas en mode diff-mode, C-x v p appellera (vc-diff nil).

Installation

La version initiale est gardée dans SVN ; il y a un miroir git. Récupérer le fichier .el et le mettre quelque part dans =load-path=. Ajouter (require 'vc-partial-commit)) dans votre .emacs.

Bogues

Il n’y a pas de vérification que le patch créé s’applique correctement. Si ce n’est pas le cas, la copie de travail va se retrouver dans un état intermédiaire. Cela m’est déjà arrivé à cause de fichiers mélangeant les fins de ligne. Pour retomber sur ses pieds, utilisez vc-partial-commit-restore-working-file. De telles situations devraient probablement être détectées et gérées depuis vc-partial-commit.

On devrait peut-être considérer vc-partial-commit comme une action potentielle de vc-next-action.

vc-partial-commit's People

Contributors

fperrin avatar

Watchers

 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.