You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using following code for detecting changes between commits:
diff=commit.diff(*parents, R=True, M=True)
Everything works ok in except of renames. When I use M = True it should detect renames instead of add / deletions. However, when I use it, it doesn't return anything. Is this a bug or did I just misunderstand how to use it?
The thing I noticed in git log -M is that instead of R it shows me R100 (not really sure whether it's normal or not):
commit a8b61b9d18350a3d44e50fc9614279a2654b646d
Author: ondrowan <...>
Date: Sat Nov 5 12:16:21 2011 +0100
Sorry for the late reply, and I have to admit that I won't be able to get a look at the issue before January 2012.
Its on my list of things to do, and it won't get lost.
Thanks for having taken the time to post this,
Sebastian
I didn't yet reproduce it, thus I don't know if it is a bug or not. As I am still not able to dedicate much (if any) time to gitpython, there is no ETA on this.
Its not forgotten either, however, if you want to get it fixed soon, you might be better off digging in yourself for now.
I am trying to get renames in a different way, but also having issues. It doesn't seem to recognize that anything has been renamed when I do:
diff = repo.head.commit.diff('HEAD~1')
# diff contains a single item that resulted from a git rename command
for item in diff.iter_change_type('R'):
print('file: ' + item.b_blob.path) # this doesn't get printed
So, I agree that there seems to be an issue with the renamed files.
The reason for this not working was that by default, it would only diff in --raw format, thus not creation patches. In that mode, previously it wouldn't support renames, which was explicitly enabled only if create_patch=True.
Now renames are always detected, and the raw mode parser will detect this as well.
The test suite was adjusted with an additional test case.
Activity
Byron commentedon Dec 5, 2011
Hi,
Sorry for the late reply, and I have to admit that I won't be able to get a look at the issue before January 2012.
Its on my list of things to do, and it won't get lost.
Thanks for having taken the time to post this,
Sebastian
ondrowan commentedon Feb 11, 2012
Any ETA on this? Or is the development discontinued as last commit was authored 7 months ago?
Byron commentedon Feb 12, 2012
I didn't yet reproduce it, thus I don't know if it is a bug or not. As I am still not able to dedicate much (if any) time to gitpython, there is no ETA on this.
Its not forgotten either, however, if you want to get it fixed soon, you might be better off digging in yourself for now.
jbranchaud commentedon Apr 18, 2013
I am trying to get renames in a different way, but also having issues. It doesn't seem to recognize that anything has been renamed when I do:
So, I agree that there seems to be an issue with the renamed files.
detect renames in "git diff --raw" output
Byron commentedon Jan 8, 2015
The reason for this not working was that by default, it would only diff in
--rawformat, thus not creation patches. In that mode, previously it wouldn't support renames, which was explicitly enabled only ifcreate_patch=True.Now renames are always detected, and the raw mode parser will detect this as well.
The test suite was adjusted with an additional test case.