Skip to content

j-woz/virken

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virken

A Version Control Menu tool.

Simply wraps the output of git status in a useful menu, so you can quickly view, edit, diff, revert, and commit changes, etc., often with single keystrokes.

Also works with Subversion. Additionally offers a limited filesystem browser.

Preview

Typical view after making a change to the kernel:

 git@github.com:torvalds/linux.git . @master

          1) _M CREDITS
  ==>     2) _M net/handshake/netlink.c
          3) A_ note-to-linus.txt
       X  4) ?? note-to-self.txt

  GIT:

In the current state:

  • Typing c will commit note-to-linus.txt

  • Typing X will delete note-to-self.txt (it was already marked for deletion with x

  • Typing a will add netlink.c to the git index

  • Typing d will show the diff for netlink.c. Typing e will open it for viewing and typing v will open it for editing.

Installation

$ git clone https://github.com/j-woz/virken.git
$ pip install virken

Run with virken.

See virken -h.

Use virken-debug to run from the source tree (not the pip installed code).

Metadata

Meaning

The name is just a play on version control, but coincidentally means "work" in Danish.

Dependencies

Requires Python 3.6 for PosixPath iterable stuff. No other packages.

Implemented using Python’s curses library and typical command-line tools.

Implementation plan

We simply show the output from git status (or svn status or ls), then capture a keystroke and run the corresponding shell command. We have to fall out of curses to run other tools that use curses (like the pager, editor, etc.); this is the most complicated part of the control logic.

Usage

Type h for help and get:

VIRKIN HELP

Space:  select item
Enter:  refresh
Number: select menu item
a:      Add to VC                     UP:   Move up
A:      Select all                    P:    Page up
b:      Show blame                    DOWN: Move down
c:      Change directory              N:    Page down
C:      VC commit selected+           ^:    Go up a directory
d:      VC diff+                      <:    Back directory*
D:      Two file diff                 >:    Forward directory*
e:      Examine file in PAGER         +:    Create directory*
g:      Glob
f:      Toggle FS mode
G:      Git subcommand
h:      Show this help
I:      Toggle show ignored files
j:      Jump to number
k:      Mark: Move to backup file
K:      Mark: Copy to backup file
l:      Load marks
L:      View VC log
q:      Quit
s:      Save marks
S:      Subversion subcommand (resolve@, stash@, un-add*)
t:      Toggle show file status
v:      Launch editor
V:      reVert
w:      Where (search)
x:      Mark: Delete
X:      Expunge marked deletes and backups
z:      Select zero (hide arrow)
::      Control line (like vi)*

+ Command will operate with no arguments if nothing is selected.
@ Command will operate with current argument if nothing is selected.
* Not yet implemented

Virken automatically detects the relevant version control (VC) system (Git, Subversion, or plain FS). The commands use the correct tool based on the detected VC.

Files may be "marked" as "select", "backup", or "delete". The marks apply to many of the commands. So, for example, you can select multiple files, diff all of them, and then quickly commit them with very few keystrokes.

You can save the marks with s, quit Virken, then launch it again, and your marks will automatically be reloaded. The marks are stored in ./.virken.json .

Environment

These environment variables have an effect on Virken:

VIRKEN_EDITOR or EDITOR

Used to select the editor for key v.

VIRKEN_PAGER or PAGER

Used to select the pager for key e.

Environment variables set by Virken:

VIRKEN_HOME

Set to the directory containing the Virken you are running. Can be used by tools to detect they are running under Virken.

Backup files

Many commands make GNU-style backup files (with a tilde). These include commands k (move to backup), V (reVert).

About

Version control menu

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published