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
TypeError: commit() got an unexpected keyword argument 'authored_date'
Then I looked at the source and found out it does not really have parameters for commit datetime. (or am I missing something? Would you be interested in a PR which adds these parameters? I am interested to learn and make contribution 😄 )
So, I either I have to create a commit then change dates (using Commit object) or use git directly.
As you noted, there is currently no way to specify these arguments within the call. As a workaround, using environment variables seems to be working. Even though it appears slightly awkward as part of an API, I believe GitPython attempts to support standard git environment variables wherever possible.
To me it seems like a very viable amendment to support these parameters as part of the method signature. These could be added without breaking the API, and thus I would be very happy if you would consider to make a contribution. The difficulty of this task also makes it a good learning experience.
The only real advice I can make is to assure you can execute the tests locally without issues. You might want to look at the .travis.yml file to see what kind of preparations fresh checkouts need to be viable for this and how to run the tests - unfortunately the tests are not properly sandboxed and will use the GitPython checkout for read-only operations and tests.
If you have any questions coming up while working on the PR, please don't hesitate to post them here.
So, I was looking at the code again and I think adding this feature is fairly easy. Since the API already supports environment variables, most of the heavy holding is already done. here. Here's what I am gonna do:
Add parameters to take the dates author_date, commit_date (same as Commit object takes them) here
Add a new if block and move rest in elif. Since user is specifying the dates, it takes the precedence. (explicit dates > os env > default date)
No need to do the parsing the date, parse_date already does that.
Currently reading tests code. I think I should write a test similar to this but a smaller version, with just checking the dates. Will send a PR soon!
I can't seem to find out how to make commit with specifying
author_date
andcommit_date
, but it did not really work:throws:
Then I looked at the source and found out it does not really have parameters for commit datetime. (or am I missing something? Would you be interested in a PR which adds these parameters? I am interested to learn and make contribution 😄 )
So, I either I have to create a commit then change dates (using
Commit
object) or use git directly.or set OS envs before commit call:
The text was updated successfully, but these errors were encountered: