openhatch

Issue412

Title Git training mission repository should use "git am" to apply the patch (but does not)
Milestone 0.11.05 Priority bug
Waiting On Status resolved
Superseder Nosy List palhmbs, paulproteus
Assigned To palhmbs Keywords

Created on 2011-05-01.08:43:51 by paulproteus, last changed 2011-06-01.02:06:43 by paulproteus.

Files
File name Uploaded Type Edit Remove
0001-Git-commit-author3.patch palhmbs, 2011-05-29.09:40:31 application/octet-stream
0001-Git-diff-patch-tests.patch palhmbs, 2011-05-31.19:24:35 application/octet-stream
Messages
msg1979 (view) Author: paulproteus Date: 2011-06-01.02:06:43
This is live now. Very exciting.
msg1969 (view) Author: paulproteus Date: 2011-05-31.19:56:48
I still think that the "!= 1" is confusing. I've replaced it with "== 0" instead.

Other than that, I like these! Pushed to origin/master; once Hudson says they're
good, I'll deploy.
msg1968 (view) Author: palhmbs Date: 2011-05-31.19:24:35
Done. You should be fine with applying 0001-Git-Commit-author3.patch first then the 0001-Git-diff-
patch-tests.patch. At least that was the order I created them. ;-)
msg1966 (view) Author: paulproteus Date: 2011-05-31.17:09:29
Paul,

There are a lot of files here. Can you delete the ones that no longer need
review, and then tell me which ones to apply, in which order?
msg1959 (view) Author: palhmbs Date: 2011-05-31.00:37:56
A modified test.
msg1958 (view) Author: palhmbs Date: 2011-05-30.20:44:58
Your concern seems unfounded, as
if commit_diff.returncode != 1: == is checking whether the returncode is not 1  -- bd

I'll try changing the def test_do_diff_mission_correctly(self): & def 
test_do_diff_mission_incorrectly(self): tests in any case.
msg1950 (view) Author: paulproteus Date: 2011-05-29.12:37:53
Paul,

This is some complex functionality, so we should wrap it in tests. I'm glad 
you're convinced the implementation works. Can you write up a quick test that 
shows that? I'm concerned by you checking the returncode being 1; usually for 
command line apps, 1 indicates an error.

It should be easy enough to do write that test; just call the controller class 
directly, passing it input.

This is good work so far; thank you for getting it this far.
msg1946 (view) Author: palhmbs Date: 2011-05-29.08:59:11
Ok, I think I've mastered this. - Please review!
msg1902 (view) Author: paulproteus Date: 2011-05-27.16:42:57
Just a few things that should get cleaned up here:

* You seem to be adding a commented-out line. That's usually not a good idea. If
the line should get removed, just remove it.

* You should check that the exist status of "git am" is zero.

* You don't need the extra quotation marks in the final call to "git commit". To
be precise, do this:

subprocess.Popen(['git', 'commit', '--allow-empty', '-m', commit_msg],
cwd=repo.repo_path)

instead of

subprocess.Popen(['git', 'commit', '--allow-empty', '-m', '"' + commit_msg +
'"'], cwd=repo.repo_path)

(The great thing about the subprocess module is that it handles all the escaping
for you. Adding quotation marks there, therefore, will add them literally to the
data that we use as the commit log message. By the way, this is a *totally super
awesome* thing about subprocess, that we can relax and not worry about escaping.
Life is grand when we have good tools.)

You're on the right track. Thanks for getting this far.! Can you fix those
things and resubmit it?
msg1897 (view) Author: palhmbs Date: 2011-05-26.11:05:42
Ok, now we are submitting the users diff output through to git am
and then adding a commit message over the top.

Please review!
msg1825 (view) Author: paulproteus Date: 2011-05-04.14:55:53
But that's not a proper simulation of what happens with a real project, because 
in a real project, the user's git configuration chooses what name and email 
address shows up.

I think we should really use 'git am' unless you can simulate it in another way 
that works just as well.

If we go the 'git am' route, we'll need to pass the user's input to 'git am' in 
that case. We can do that with subprocess module. If you need help with it, just 
ask.
msg1808 (view) Author: palhmbs Date: 2011-05-02.02:58:33
Attached is a patch that should resolve this issue.
Since the openhatch users name will now appear in the git log.
msg1805 (view) Author: palhmbs Date: 2011-05-01.23:04:11
Let's just change the commit with --author="openhatch username 
<username@openhatch.org>" ??
msg1785 (view) Author: paulproteus Date: 2011-05-01.08:43:51
The git mission, as it stands right now, has "The Brain" be the author of the 
second commit, even though the user submitted a patch file.

The correct behavior is that the user's patch file guides the author, so the user 
can see (enthusiastically) that his/her name appears in 'git log'.

To fix this, we need to have the mission use 'git am' to apply the patch.

We can add a commit on top with the secret word so that the rest of the code 
doesn't have to change.
History
Date User Action Args
2011-06-01 02:06:43paulproteussetstatus: need-review -> resolved
messages: + msg1979
2011-05-31 19:56:48paulproteussetmessages: + msg1969
2011-05-31 19:24:35palhmbssetfiles: + 0001-Git-diff-patch-tests.patch
messages: + msg1968
2011-05-31 19:23:26palhmbssetfiles: - 0001-Git-diff-patch-tests.py
2011-05-31 19:21:36palhmbssetfiles: - 0001-Git-commit-author2.patch
2011-05-31 19:21:31palhmbssetfiles: - 0001-Git-commit-author.patch
2011-05-31 17:09:29paulproteussetmessages: + msg1966
2011-05-31 00:37:56palhmbssetstatus: in-progress -> need-review
files: + 0001-Git-diff-patch-tests.py
messages: + msg1959
2011-05-30 20:44:59palhmbssetmessages: + msg1958
2011-05-29 12:37:53paulproteussetstatus: need-review -> in-progress
messages: + msg1950
2011-05-29 09:40:31palhmbssetfiles: + 0001-Git-commit-author3.patch
2011-05-29 09:40:18palhmbssetfiles: - 0001-Git-commit-author3.patch
2011-05-29 08:59:12palhmbssetstatus: in-progress -> need-review
files: + 0001-Git-commit-author3.patch
messages: + msg1946
2011-05-27 16:42:58paulproteussetstatus: need-review -> in-progress
messages: + msg1902
2011-05-26 11:05:42palhmbssetstatus: in-progress -> need-review
files: + 0001-Git-commit-author2.patch
messages: + msg1897
2011-05-04 14:55:53paulproteussetstatus: need-review -> in-progress
messages: + msg1825
2011-05-02 05:42:26palhmbssetfiles: + 0001-Git-commit-author.patch
2011-05-02 05:40:49palhmbssetfiles: - 0001-Git-commit-author3.patch
2011-05-02 05:19:02palhmbssetfiles: + 0001-Git-commit-author3.patch
2011-05-02 05:17:49palhmbssetfiles: - 0001-Git-commit-author.patch
2011-05-02 02:58:33palhmbssetstatus: in-progress -> need-review
files: + 0001-Git-commit-author.patch
messages: + msg1808
2011-05-02 00:15:19palhmbssetstatus: chatting -> in-progress
assignedto: palhmbs
2011-05-01 23:04:11palhmbssetstatus: unread -> chatting
messages: + msg1805
2011-05-01 10:15:45palhmbssetnosy: + palhmbs
milestone: 0.11.05
2011-05-01 08:43:51paulproteuscreate