GithubHelp home page GithubHelp logo

andrewshadura / git-crecord Goto Github PK

View Code? Open in Web Editor NEW
187.0 8.0 12.0 458 KB

Git subcommand to interactively select changes to commit or stage

License: GNU General Public License v2.0

Python 100.00%
git vcs tui curses text-user-interface

git-crecord's Introduction

Git crecord

About

git-crecord is a Git subcommand which allows users to interactively select changes to commit or stage using a ncurses-based text user interface. It is a port of the Mercurial crecord extension originally written by Mark Edgington.

Screenshot of git-crecord in action

git-crecord allows you to interactively choose among the changes you have made (with line-level granularity), and commit, stage or unstage only those changes you select. After committing or staging the selected changes, the unselected changes are still present in your working copy, so you can use crecord multiple times to split large changes into several smaller changesets.

Installation

git-crecord assumes you have Python 3.9 or later installed as /usr/bin/python3.

git-crecord ships with a setup.py installer based on setuptools. To install git-crecord, simply type:

./setup.py install

This will install git-crecord itself, its manpage and this README file into their proper locations.

Alternatively, to install it manually, symlink git-crecord into the directory where Git can find it, which can be a directory in your $PATH:

ln -s $PWD/git-crecord ~/.local/bin/git-crecord

Now you should have a new subcommand available for you.

When you're ready to commit some of your changes, type:

git crecord

This will bring up a window where you can view all of your changes, and select/de-select changes. You can find more information on how to use it in the built-in help (press the '?' key).

git crecord supports most popular options of git commit: --author=, --date=, --message=, --amend, --signoff.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 text for more details.

You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Authors

For the list of contributors, see CONTRIBUTORS.

git-crecord's People

Contributors

andrewshadura avatar antonv6 avatar carun avatar ccrtnsp avatar charignon avatar durin42 avatar edgimar avatar edwardbetts avatar gward avatar hotsphink avatar immerrr avatar jakalx avatar jnrowe avatar jordigh avatar madski-unity avatar marmoute avatar nriley avatar okeeblow avatar parren avatar phloxic avatar piranha avatar pklapperich avatar pulkit07 avatar quark-zju avatar ryanmce avatar seanfarley avatar spectral54 avatar sunshowers avatar yuja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-crecord's Issues

NameError: global name 'origsigwinchhandler' is not defined

Steps to reproduce:

  1. Make any change, e.g., 'echo "I'm a little teapot">>README.rst
  2. git-crecord
  3. type 's', then 'y'
    Result: A traceback on the terminal, and the changes are not staged. The full traceback reads:
  File "./git-crecord", line 4, in <module>
    main()
  File "/home/jepler/src/git-crecord/git_crecord/main.py", line 185, in main
    crecord_core.dorecord(ui, repo, None, **(opts))
  File "/home/jepler/src/git-crecord/git_crecord/crecord_core.py", line 202, in dorecord
    return recordfunc(ui, repo, "", None, opts)
  File "/home/jepler/src/git-crecord/git_crecord/crecord_core.py", line 71, in recordfunc
    chunk_selector.chunkselector, ui)
  File "/home/jepler/src/git-crecord/git_crecord/crpatch.py", line 687, in filterpatch
    chunkselector(opts, headers, ui)
  File "/home/jepler/src/git-crecord/git_crecord/chunk_selector.py", line 71, in chunkselector
    curses.wrapper(chunkselector.main, opts)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/jepler/src/git-crecord/git_crecord/chunk_selector.py", line 1122, in main
    return self._main(stdscr)
  File "/home/jepler/src/git-crecord/git_crecord/chunk_selector.py", line 1185, in _main
    signal.signal(signal.SIGWINCH, origsigwinchhandler)
NameError: global name 'origsigwinchhandler' is not defined

Tested at commit ec11e17

option to discard/revert hunks

With git gui and git checkout -p there are command-line and
interactive graphical interfaces to discard changes made to existing
files. It would be nice for git crecord to have an equivalent option
so there is an interactive terminal interface to discard changes.

(Reported by Paul Wise)

Rework calls to git

Right now, git-crecord calls git to perform all Git operations; it uses code derived from Mercurial to do that. However, it’s quite verbose and sometimes using subprocess directly was still necessary.

pristine-lfs uses python-sh to talk to Git, but maybe using Dulwich or GitPython could work too?

In the past, Dulwich was used for some functionality, but other parts required Git anyway, so Dulwich was replaced by a hand-rolled alternative. Maybe this is the time to reconsider.

Unintuitive (buggy?) staging behavior / inconsistent documentation

I use git add -p a lot to stage individual hunks before creating a commit, so I tried to replicate that flow using git crecord. Since the README only mentions the crecord subcommand (which is also the name of the project), I assumed it was the only one available.

Once inside the git crecord interface, I used the quick help message at the top, which says that the c keystroke "confirms" the present selection. However, when I did that, I was immediately brought to a text editor to write a commit message. I saved an empty message to abort the commit, expecting the changes to remain staged, only to find that the selection I had made was lost.

I then tried again, and pressed ? to open the extended help message, which says that c actually stands for "commit", and s is the keystroke I should use for staging. So I tried that, but the behavior was the same: I was dropped into an editor to write a commit message, and exiting with an empty message still didn't keep my changes staged.

There are a few issues here:

  1. The short help message doesn't make it clear that pressing c will instanty initiate a commit. That was surprising behavior.
  2. If I run git crecord and press c after making a selection, and then choose to abort the commit, the changes should either remain staged, or I should at least be offered the option to make them so, to prevent losing the selection I had made.
  3. Confusing documentation: the short and extended help messages should be consistent about the meaning of pressing c (commit vs confirm selection). Also, the README makes no mention of the other subcommands (which I assume might be the intended way to initiate a non-commit action?)
  4. If I press the s key, I should not be prompted to make a commit at all.
  5. If I abort the commit after pressing s, the selection should definitely remain staged!

I'm not sure how many of these are the result of bugs, of me misunderstanding the usage of the tool, or something else, which is why I didn't open separate issues for each of the problems I listed above. Let me know if you'd like me to do so! :)

Support python3

It seems that this only works under python2. Unfortunately I use python3 as my daily driver, it would be nice to work under both python2 and python3.

Shortcuts to navigate to the top/bottom of the window

Typically the shortcuts used in man, less, more and such tools are very handy. Similarly, it would be nice if we can use such shortcuts for navigation in crecord.

  • G to navigate to the bottom
  • g to navigate to the top.

corruption of staged/commited changes

Hey Andrew.

I found a case where I think crecord causes corruption (of the merged data), unfortunately I couldn't find a simple reproducer, so I'll mail you my test files (which I rather don't want to be public) afterwards [edit: done] (@debian.org).

There will be a file.v1 which is the "orginal" state and committed to the repo. And file.v2, which contains multiple modifications, of which some will staged via crecord.

Here's how to reproduce the issue with them:

git init test
mv ../file.v1 file
git add file
git commit file -m foo
mv -f ../file.v2 file

If you look now at the changes with e.g. git difftool -d, you'll see 2 hunks:

  1. there's one hunk in the "middle", which
    • changes two comment lines and adds a bunch of other non-empty lines right after them
    • there's no changes in empty / whitespace-only lines
  2. there's another hunk nearly in the end, which:
    • adds 4 empty lines after the last function, then another block of code, and then there's again 16 empty lines and copyright comment (which were already there).
    • so old code,… 4 new empty lines,… a new block of code… 16 old empty lines and some comments

Now:

git crecord

and within that:

  • unselect everything
  • from the 1st hunk, select only the 2 removed and 1 added comment lines (the first three shown lines one can select), but don't select anything else
  • from the 2nd hunk select everything

You already should see that the 2nd hunk looks odd, it starts right with the new block of code (no leading 4 newlines) and ends with 4 empty newlines (which could of course just be from the positioning of the hunk.

But when now staging and yes... and then git difftool -d --staged, you'll see 2 hunks:

  • the changed comment lines,... which are good
  • but the 2nd hunk is broken, it's now:
    • old code
    • 13 empty lines
    • the new block of code
    • only 7 remaining ones of the previously 16 empty lines
    • the comments

When you now commit the staged changes (i.e. no further adds of the not yet staged changes + git commit -m bar)... and then git reset --hard the remaining (not yet staged changes, which should only be the non-comment lines from the middle hunk), you see that the end of the actually committed file is messed up, and now as it was before.

I presume there's something wrong with the placement of the hunk.

Cheers,
Chris.

Using mouse to select or deselect hunks

Is it possible to use mouse to select or deselect hunks? Keyboard works pretty well, but sometimes using mouse would be more convenient as well and crecord would give the power of GUI at the terminal with mouse clicks.

Wrong branch name in commit info text

I am working in a branch that is not master, and the info text to create the commit message was:

# Please enter the commit message for your changes. Lines starting  
# with '#' will be ignored, and an empty message aborts the commit. 
# On branch master

This master is hard coded (crecord_core.py). I know it is just an info, but it is really confusing.

Splitting a hunk can result in reordered lines

I’m not sure I know 100% how to reproduce this, but I had something along these lines yesterday:

 RUN apt-get update \
- && apt-get install -y supervisor python3.8 \
-    git python3-pip ssl-cert
+ && apt-get install -y supervisor python3.9 \
+    git python3-pip ssl-cert time

I realised I want to commit those separately, so I went ahead and only selected first lines of each - and +. It resulted in this:

 RUN apt-get update \
- && apt-get install -y supervisor python3.8 \
     git python3-pip ssl-cert
+ && apt-get install -y supervisor python3.9 \

On one hand this is literally what I had selected, but it was not at all what I intended — I wonder whether this shouldn’t be handled more cleverly.

Removing of EOL produces incorrect patch

Prepare a test repo:

git init
echo test > test
git add test
git commit -m test
echo -n test > test

This produces a diff:

diff --git a/test b/test
index 9daeafb9864c..30d74d258442 100644
--- a/test
+++ b/test
@@ -1 +1 @@
-test
+test
\ No newline at end of file

This is being parsed as:

diff --git a/test b/test
index 9daeafb9864c..30d74d258442 100644
--- a/test
+++ b/test
@@ -1,1 +1,1 @@
-test
\ No newline at end of file
+test

Feature request: Version argument

🞂 git crecord --version
usage: git crecord [-h] [--author AUTHOR] [--date DATE] [-m MESSAGE] [-c COMMIT] [-C COMMIT] [--reset-author] [-s] [--amend] [-S [KEY-ID]] [-v] [--debug] [--quiet] [--confirm]
git crecord: error: unrecognized arguments: --version
🞂 git crecord -V
usage: git crecord [-h] [--author AUTHOR] [--date DATE] [-m MESSAGE] [-c COMMIT] [-C COMMIT] [--reset-author] [-s] [--amend] [-S [KEY-ID]] [-v] [--debug] [--quiet] [--confirm]
git crecord: error: unrecognized arguments: -V

this diff is too large to be displayed

Having seen the mention of git-crecord, I tried it out.

When running, I get the following error:

$ git merge foo bar
$ \#There are some merge conflicts at this stage.
$ git crecord -vvv
abort: this diff is too large to be displayed

My version of crecord is from Debian:

ii  git-crecord                                   20220324.0-1                                 all          interactively select chunks to commit with Git

numpadlines is reported: 189464
xscreensize is reported: 194

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 38: ordinal not in range(128)

Happens when trying to toggle a hunk fold

Changeset: 9d83975 on master

Traceback (most recent call last):
  File "/usr/bin/git-crecord", line 9, in <module>
    load_entry_point('git-crecord==20161226.0', 'console_scripts', 'git-crecord')()
  File "/usr/lib/python2.7/site-packages/git_crecord/main.py", line 193, in main
    crecord_core.dorecord(ui, repo, None, **(opts))
  File "/usr/lib/python2.7/site-packages/git_crecord/crecord_core.py", line 190, in dorecord
    return recordfunc(ui, repo, "", None, opts)
  File "/usr/lib/python2.7/site-packages/git_crecord/crecord_core.py", line 71, in recordfunc
    chunk_selector.chunkselector, ui)
  File "/usr/lib/python2.7/site-packages/git_crecord/crpatch.py", line 686, in filterpatch
    chunkselector(opts, headers, ui)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 71, in chunkselector
    curses.wrapper(chunkselector.main, opts)
  File "/usr/lib64/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 1126, in main
    return self._main(stdscr)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 1179, in _main
    self.updatescreen()
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 592, in updatescreen
    self.printitem()
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 762, in printitem
    towin=towin)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 808, in __printitem
    recursechildren, outstr, towin)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 816, in __printitem
    recursechildren, outstr, towin)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 825, in __printitem
    recursechildren, outstr, towin)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 831, in __printitem
    towin=towin))
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 745, in printhunkchangedline
    towin=towin, showwhtspc=True)
  File "/usr/lib/python2.7/site-packages/git_crecord/chunk_selector.py", line 510, in printstring
    window.addstr(text, colorpair)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 38: ordinal not in range(128)

Please point shebang at env instead of directly at python3

I don't have python3 installed in /usr/bin/python3 so setup.py fails. This is a minor issue, but common practice is to change the shebang to read #!/usr/bin/env python3. I'm not sure if the location of the env binary is defined in POSIX, but I've not seen a system where this fails. MacOS, FreeBSD, Solaris all put env in /usr/bin, and I think all modern Linux distros do, too (often on Linux I see it in symlinked to both /bin/ and /usr/bin).

Steps to reproduce

  1. Install python3 to a location other than /usr/bin/python3 (ex, installing via brew on a Mac or to your home folder on a system where you don't have root access).
  2. Ensure python3 is in your path
  3. Run setup.py
$ ./setup.py install
-bash: ./setup.py: /usr/bin/python3: bad interpreter: No such file or directory

Workaround
a user can just run python3 setup.py install instead, so this isn't a big deal, but it's also an easy fix.

Proposed Fix

$ head setup.py 
#!/usr/bin/env python3

import os
import fnmatch

Ctrl-↑ crashes with a TypeError

$ git crecord
Traceback (most recent call last):
  File "/usr/lib/git-core/git-crecord", line 11, in <module>
    load_entry_point('git-crecord==20161226.0', 'console_scripts', 'git-crecord')()
  File "/usr/lib/python3/dist-packages/git_crecord/main.py", line 188, in main
    crecord_core.dorecord(ui, repo, None, **(opts))
  File "/usr/lib/python3/dist-packages/git_crecord/crecord_core.py", line 190, in dorecord
    return recordfunc(ui, repo, "", None, opts)
  File "/usr/lib/python3/dist-packages/git_crecord/crecord_core.py", line 71, in recordfunc
    chunk_selector.chunkselector, ui)
  File "/usr/lib/python3/dist-packages/git_crecord/crpatch.py", line 686, in filterpatch
    chunkselector(opts, headers, ui)
  File "/usr/lib/python3/dist-packages/git_crecord/chunk_selector.py", line 71, in chunkselector
    curses.wrapper(chunkselector.main, opts)
  File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3/dist-packages/git_crecord/chunk_selector.py", line 1126, in main
    return self._main(stdscr)
  File "/usr/lib/python3/dist-packages/git_crecord/chunk_selector.py", line 1187, in _main
    if self.handlekeypressed(keypressed):
  File "/usr/lib/python3/dist-packages/git_crecord/chunk_selector.py", line 1109, in handlekeypressed
    elif curses.unctrl(keypressed) in [b"^L"]:
TypeError: expect bytes or str of length 1, or int, got a str of length 4

add a mode that allows `crecord` to operate on the staging area

Hey.

#52 brought me to the idea that it would indeed be nice, if crecord had a mode where it operates on the stating area.

In that mode it would show all staged changes, and unselecting any would unstage exactly these changes while keeping all others.

Cheers,
Chris.

Add support for pathspecs

I just discovered and installed this project and it's really great. I've been looking for a CLI tool to do line-by-line staging for a long time.

I think it would be even more great if git crecord would support pathspecs arguments, just as git commit, git add, git restore, git checkout, git reset and git stash push do.

So if i know that I just want to selectively stage lines in file foo, but file bar is also modified, I could do

git crecord foo

New release?

I just saw that the last release on the github release page was from 2016 ... I don't know how much progress was there since then, but maybe it is time for another release?

Feel free to ping me if you do it, so I can package the update for nixpkgs.

TypeError: togglefolded() got an unexpected keyword argument 'foldParent'

$ git crecord
Traceback (most recent call last):
  File "/home/arun/.bin/git-crecord", line 4, in <module>
    main()
  File "/home/arun/code/git-crecord/git_crecord/main.py", line 193, in main
    crecord_core.dorecord(ui, repo, None, **(opts))
  File "/home/arun/code/git-crecord/git_crecord/crecord_core.py", line 190, in dorecord
    return recordfunc(ui, repo, "", None, opts)
  File "/home/arun/code/git-crecord/git_crecord/crecord_core.py", line 71, in recordfunc
    chunk_selector.chunkselector, ui)
  File "/home/arun/code/git-crecord/git_crecord/crpatch.py", line 686, in filterpatch
    chunkselector(opts, headers, ui)
  File "/home/arun/code/git-crecord/git_crecord/chunk_selector.py", line 71, in chunkselector
    curses.wrapper(chunkselector.main, opts)
  File "/usr/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/arun/code/git-crecord/git_crecord/chunk_selector.py", line 1126, in main
    return self._main(stdscr)
  File "/home/arun/code/git-crecord/git_crecord/chunk_selector.py", line 1187, in _main
    if self.handlekeypressed(keypressed):
  File "/home/arun/code/git-crecord/git_crecord/chunk_selector.py", line 1104, in handlekeypressed
    self.togglefolded(foldParent=True)
TypeError: togglefolded() got an unexpected keyword argument 'foldParent'

git submodule add followed by git crecord fails with IsADirectoryError

2020-08-06 15:38:07 ~/code/aim-es-v3 (neoface-license-deps)
$ git submodule add --name neoface-license-dependencies ssh://[email protected]:7999/did/neoface-license-dependencies.git docker/neoface-license-dependencies

2020-08-06 15:43:07 ~/code/aim-es-v3 (neoface-license-deps)
$ git status
On branch feature/neoface-license-deps
Your branch is up to date with 'origin/feature/neoface-license-deps'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   .gitmodules
        new file:   docker/neoface-license-dependencies

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

        modified:   docker/neoface-license-dependencies (untracked content)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        build/

2020-08-06 15:38:20 ~/code/aim-es-v3 (neoface-license-deps)
$ git crecord
Traceback (most recent call last):
  File "/usr/local/bin/git-crecord", line 11, in <module>
    load_entry_point('git-crecord==20161226.0', 'console_scripts', 'git-crecord')()
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/main.py", line 193, in main
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/crecord_core.py", line 190, in dorecord
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/crecord_core.py", line 111, in recordfunc
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/util.py", line 97, in copyfile
  File "/usr/lib/python3.6/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: '/home/arun/code/aim-es-v3/docker/neoface-license-dependencies'
2020-08-06 15:38:32 ~/code/aim-es-v3 (neoface-license-deps)
$

Error on window

Hello,

When trying to start git crecord on Window 10 (Python 3.6.5), I get this error

Traceback (most recent call last):
    File "C:\Python36\Scripts\git-crecord-script.py", line 11, in <module>
        load_entry_point('git-crecord==20161226.0', 'console_scripts', 'git-crecord')()
    File "C:\Python36\lib\site-packages\pkg_resources\__init__.py", line 480, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
    File "C:\Python36\lib\site-packages\pkg_resources\__init__.py", line 2693, in load_entry_point
        return ep.load()
    File "C:\Python36\lib\site-packages\pkg_resources\__init__.py", line 2324, in load
        return self.resolve()
    File "C:\Python36\lib\site-packages\pkg_resources\__init__.py", line 2330, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
    File "C:\Python36\lib\site-packages\git_crecord-20161226.0-py3.6.egg\git_crecord\main.py", line 2, in <module>
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
    File "C:\Python36\lib\site-packages\git_crecord-20161226.0-py3.6.egg\git_crecord\gitrepo.py", line 3, in <module>
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
    File "C:\Python36\lib\site-packages\git_crecord-20161226.0-py3.6.egg\git_crecord\util.py", line 18, in <module>
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
    File "C:\Python36\lib\site-packages\git_crecord-20161226.0-py3.6.egg\git_crecord\encoding.py", line 95, in <module>
    File "C:\Python36\lib\site-packages\git_crecord-20161226.0-py3.6.egg\git_crecord\encoding.py", line 95, in <genexpr>
    NameError: name 'tolocal' is not defined            

This function tolocal seem to have been deleted in this commit

4b934b5#diff-e70008c4c3db9a1177a57aadd8454f4b

Installation fails

Hi,

already "reported" it on Reddit but here's a proper issue.

Steps to reproduce

  1. Have Ubuntu 16.04.
  2. Clone master on commit 30c7f4c in /tmp/git-crecord
  3. Run python2 setup.py install --user

Expected result

Git crecord installs into my home directory.

Actual result

Traceback (most recent call last):
  File "setup.py", line 80, in <module>
    (os.path.join('share', 'doc', __name__), glob('*.rst')),
  File "setup.py", line 11, in glob
    return fnmatch.filter(os.listdir(os.path.dirname(__file__)), fname)
OSError: [Errno 2] No such file or directory: ''

Let me know what other information you need.

bash/command completion

Hey.

Would be nice if there was bash/command completion for crecord.

Right now, it seems that not even git crecord alone is completed, though I'd have expected that this would be still done by git’s completion.

E.g. looking at git-evtag, which in Debian ships no bash completion file either, at least the base command evtag itself is completed.

Maybe it's because of the different install locations, crecord is installed as /usr/lib/git-core/git-crecord, evtag as /usr/bin/git-evtag.
Perhaps git’s completion blindly just takes and /usr/bin/git-*... which I think would also rather be bad by itself.

Cheers,
Chris.

prompt when there are untracked files that are not ignored

When in a git repository with untracked files that are not ignored, it would be nice to be able to stage and or commit those files.

pabs@chianamo ~ $ mkdir tmp-git-crecord-staging/
pabs@chianamo ~ $ cd tmp-git-crecord-staging/
pabs@chianamo ~/tmp-git-crecord-staging $ git init
Initialized empty Git repository in /home/pabs/tmp-git-crecord-staging/.git/
pabs@chianamo ~/tmp-git-crecord-staging (master #) $ touch foo
pabs@chianamo ~/tmp-git-crecord-staging (master #%) $ git crecord
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
no changes to record
pabs@chianamo ~/tmp-git-crecord-staging (master #%) $ git add foo
pabs@chianamo ~/tmp-git-crecord-staging (master +) $ git commit -am foo
[master (root-commit) 7daca94] foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
pabs@chianamo ~/tmp-git-crecord-staging (master) $ touch bar
pabs@chianamo ~/tmp-git-crecord-staging (master %) $ git crecord
no changes to record

(Reported by Paul Wise <@pabs3>)

Install problem from pip

I haven't worked much with setup.py, but when I try to install using python2-pip (installed as pip2 on my system) I get an error about absolute paths. I'm not sure if the version on pypi is just out of date (and should be updated) or if setup.py needs to be updated to pass pypi's checks, but this seemed like an OK place to inform you of the problem:

$ sudo pip2 install git-crecord
Collecting git-crecord
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/87/aa/b67aa4b084e57bc00a5a1d4b07a4dc037136ca4b3b51563ea8dbd5d1e752/git-crecord-20161226.0.tar.gz (77kB)
    100% |████████████████████████████████| 81kB 1.8MB/s 
Requirement already satisfied: docutils>=0.12 in /usr/lib/python2.7/site-packages (from git-crecord)
Installing collected packages: git-crecord
  Running setup.py install for git-crecord ... error
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PJITrz/git-crecord/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-FlovhE-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/git_crecord
    copying git_crecord/util.py -> build/lib/git_crecord
    copying git_crecord/crecord_core.py -> build/lib/git_crecord
    copying git_crecord/__init__.py -> build/lib/git_crecord
    copying git_crecord/gitrepo.py -> build/lib/git_crecord
    copying git_crecord/main.py -> build/lib/git_crecord
    copying git_crecord/chunk_selector.py -> build/lib/git_crecord
    copying git_crecord/crpatch.py -> build/lib/git_crecord
    copying git_crecord/encoding.py -> build/lib/git_crecord
    running egg_info
    writing requirements to git_crecord.egg-info/requires.txt
    writing git_crecord.egg-info/PKG-INFO
    writing top-level names to git_crecord.egg-info/top_level.txt
    writing dependency_links to git_crecord.egg-info/dependency_links.txt
    writing entry points to git_crecord.egg-info/entry_points.txt
    reading manifest file 'git_crecord.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'git_crecord.egg-info/SOURCES.txt'
    error: Error: setup script specifies an absolute path:
    
        /tmp/pip-build-PJITrz/git-crecord/README.rst
    
    setup() arguments must *always* be /-separated paths relative to the
    setup.py directory, *never* absolute paths.

Is staging working?

Hi,

When I tried Mercurial for the first time a couple of months ago, I was astonished to see how much more convenient the hg record (in fact, it is crecord) over the poor UI of git add -p. So I looked around to see if someone had tried to port crecord to git. This project does exactly that and it seems very promising!

When I selected some hunks though and typed s (stage), vim opens for typing a commit message.
Also, how hard would it be to have the currently staged state when opening git crecord?

Thanks again,

Maël

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.