problem with running test of dual_matrix method--attribute issue

35 views
Skip to first unread message

Comer Duncan

unread,
Apr 14, 2012, 10:22:11 AM4/14/12
to sy...@googlegroups.com, Matthew Rocklin
Hi,

Can someone please help me get past the following issue?

I have added a new method to sympy/matrices/matrices.py to compute the
matrix dual of a given matrix. The name of the method is
dual_matrix(). I have added this method to my local copy of sympy
(test1) and have done a git add and git commit. I have also put a
test_dual_matrix function at the bottom of
sympy/matrices/tests/test_matrices.py. When I run test on the
matrices I get:

[ComerMacPro:~/sympy] comerduncan% ./bin/test
sympy/matrices/tests/test_matrices.py
============================= test process starts ==============================
executable: /usr/bin/python (2.7.1-final-0)
architecture: 64-bit
cache: yes
ground types: python
random seed: 54812667

sympy/matrices/tests/test_matrices.py[106] ...fffff.............................
....................................................................E [FAIL]

________________________________________________________________________________
____________ sympy/matrices/tests/test_matrices.py:test_dual_matrix ____________
File "/users/comerduncan/sympy/sympy/matrices/tests/test_matrices.py",
line 2221, in test_dual_matrix
assert F.dual_matrix() == Matrix(
((0,B_x,B_y,B_z),(-B_x,0,E_z,-E_y),(-B_y,-E_z,0,E_x),(-B_z,E_y,-E_x,0))
)
File "/Users/comerduncan/sympy/sympy/matrices/matrices.py", line
2953, in __getattr__
raise AttributeError("Matrix has no attribute %s." % attr)
AttributeError: Matrix has no attribute dual_matrix.

tests finished: 100 passed, 5 expected to fail, 1 exceptions, in 4.34 seconds =
DO *NOT* COMMIT!

So, how come the new function dual_matrix is not seen? Is it the case
that when ./bin/test runs sympy/matrices/tests/test_matrices.py it
loads the system sympy rather than the local, in-directory sympy tree
and thus does not see any additional function(s) added at the end of
matrices.py? I am unsure about this, so I would appreciate some ideas
on what I can//should do.

Thanks very much.

Comer

Tom Bachmann

unread,
Apr 14, 2012, 10:47:47 AM4/14/12
to sy...@googlegroups.com
Hi,

the problem is that your addition of "dual_matrix" is too far down in
the file. It is now defined as a global function to which one may pass a
matrix. However, you want it as a method of the Matrix class. You could
probably put it around line 3318, after the is_Identity method (and
similarly aligned!).

Best,
Tom

Chris Smith

unread,
Apr 16, 2012, 2:26:15 PM4/16/12
to sy...@googlegroups.com
On Sat, Apr 14, 2012 at 8:07 PM, Comer Duncan <comer....@gmail.com> wrote:
> Hi,
>
> Can someone please help me get past the following issue?
>
> I have added a new method to sympy/matrices/matrices.py to compute the
> matrix dual of a given matrix. The name of the method is
> dual_matrix().  I have added this method to my local copy of sympy
> (test1) and  have done a git add and git commit. I have also put a
> test_dual_matrix function at the bottom of
> sympy/matrices/tests/test_matrices.py.  When I run test on the


Did you understand what Tom said? A little example might help. The
following shows a class foo (like Matrix) with a method and then below
there is a function with the same name:

class foo:
def meth(self):
return str(self)+'meth'

def meth(x):
return str(x)+'func'


The method would be called like this:

f = foo()
f.meth()

whereas the function would be called like this:

meth(f)

Matrix uses both functions and methods, so you just have to decide
which makes more sense. We can help you decide if you want. (That's
one of the nice things I've found about the python community in
general: they're pretty helpful in a lot of ways.)

Best regards,
Chris

Comer

unread,
Apr 17, 2012, 9:35:38 AM4/17/12
to sy...@googlegroups.com
Hi Tom,

Thanks for making the point. I implemented your suggestion immediately. Sorry for not replying.

Best,

Comer

Tom Bachmann

unread,
Apr 17, 2012, 9:36:46 AM4/17/12
to sy...@googlegroups.com
No problem. Just update your pull request and we will review it.

> --
> You received this message because you are subscribed to the Google
> Groups "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/eEM2f8rmMwEJ.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.

Comer

unread,
Apr 17, 2012, 10:30:39 AM4/17/12
to sy...@googlegroups.com
Hi Chris,

Yes, I did get what Tom was meaning and implemented it immediately that day. I was remiss in not acknowledging.

I am having a problem with indentation in my current version of the dual_matrix method.  I have been working on the new methods in ipython notebooks (ver .13 dev), which I have found to be a very productive environment.  The newest version of the method works in the notebook. However, when I key it in using my default editor TextWranger in matrices.py and run test_matrices.py it complains about indendation.  But not in the notebook.  I said keyed in above since I am a bit leary to paste code from one app to another.  However, apparently I still have made some indentation error(s).  Very annoying.  I am attaching the code. Can you take a look and give me some idea about which part of the georgraphy is inducing a stumble?  

Thanks.

Comer
dual_matrix.py

Sergiu Ivanov

unread,
Apr 17, 2012, 10:43:53 AM4/17/12
to sy...@googlegroups.com
Hello,

On Tue, Apr 17, 2012 at 5:30 PM, Comer <comer....@gmail.com> wrote:
>
> I am having a problem with indentation in my current version of the
> dual_matrix method.  I have been working on the new methods in ipython
> notebooks (ver .13 dev), which I have found to be a very productive
> environment.  The newest version of the method works in the notebook.
> However, when I key it in using my default editor TextWranger in matrices.py
> and run test_matrices.py it complains about indendation.  But not in the
> notebook.  I said keyed in above since I am a bit leary to paste code from
> one app to another.  However, apparently I still have made some indentation
> error(s).  Very annoying.  I am attaching the code. Can you take a look and
> give me some idea about which part of the georgraphy is inducing a stumble?

For me, Python chews rather happily the piece of code you have shown.
I have even tried dual_matrix(None) to get an error (obviously).

However, I have noticed that, at times, you use spaces for indenting,
and at times there are tabs. For example, line 21 is indented using a
tab, while line 22 is indented with spaces only; lines 25 and 26 are
indented with spaces at first and then with tabs, etc. While I don't
have any trouble getting this code to run, I distinctly remember that
mixing spaces and tabs caused me some problems in a different
language.

This guy [0] says that mixing spaces and tabs can be bad, too :-)

Sergiu

[0] http://www.cogsci.nl/blog/tutorials/136-fix-mixed-tabspace-indentation-in-python-code

Comer

unread,
Apr 17, 2012, 11:49:14 AM4/17/12
to sy...@googlegroups.com
Sergiu,

Thanks for the response.  I have grabbed the fixinddent code and tried it out on a copy of matrices.py. It does 'fix' some stuff in the dual_matrix() method, but the resulting code does not pass python's indentation daemon, who is ever lurking.  Clean code is clearly my objective but so far I have not seen just what silliness is being committed...

Thanks for trying to code and reporting what you saw.

Comer

Chris Smith

unread,
Apr 17, 2012, 12:29:31 PM4/17/12
to sy...@googlegroups.com
On Tue, Apr 17, 2012 at 9:34 PM, Comer <comer....@gmail.com> wrote:
> Sergiu,
>
> Thanks for the response.  I have grabbed the fixinddent code and tried it
> out on a copy of matrices.py. It does 'fix' some stuff in the dual_matrix()
> method, but the resulting code does not pass python's indentation daemon,
> who is ever lurking.  Clean code is clearly my objective but so far I have
> not seen just what silliness is being committed...
>
> Thanks for trying to code and reporting what you saw.
>
While I look at the code you might check out this note about how to
make TextWrangler autoexpand tabs to spaces (not the same thing as
setting the indentation for tabs (i.e. tab stops):

http://tinyurl.com/75q2lch

smichr

unread,
Apr 17, 2012, 1:02:16 PM4/17/12
to sympy


On Tue, Apr 17, 2012 at 8:15 PM, Comer <comer....@gmail.com> wrote:
> Hi Chris,
>
> Yes, I did get what Tom was meaning and implemented it immediately that day.
> I was remiss in not acknowledging.
>
> I am having a problem with indentation in my current version of the
> dual_matrix method.

Hmmm...it looks like you used 4 spaces but were in an environment
where the tab stop was 8. I think what you want as the final output is
something like my edited version at

http://pastebin.com/xQN5QDkj

The replacement of tabs with 8 spaces gives what is at

http://pastebin.com/0LDSs0tT .

You can see that near acum1 entries of M are updated before the final
accumulation is complete and then near acum2 the entries are not
updated with each l.

I don't know enough about how your environment might be treating lines
with mixed tab and spaces. Perhaps in one setting some whitespace
magic is worked whereas in the other a simple "replace all tabs with 8
spaces" is used which leads to the corrupted logic (but executing
code).

Hope that helps,
Chris

smichr

unread,
Apr 17, 2012, 1:16:22 PM4/17/12
to sympy
Try http://pastebin.com/a1KcN955 as the corrected version, instead.

Alan Bromborsky

unread,
Apr 17, 2012, 1:31:04 PM4/17/12
to sy...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/1lGDNyilzGUJ.

To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
You might want to consider using "geany" as an editor.  It automatically converts tabs to spaces (go to the edit preferences tabs for the editor and files).

Joachim Durchholz

unread,
Apr 17, 2012, 2:16:15 PM4/17/12
to sy...@googlegroups.com
Am 17.04.2012 19:31, schrieb Alan Bromborsky:
> You might want to consider using "geany" as an editor. It automatically
> converts tabs to spaces (go to the edit preferences tabs for the editor
> and files).

Actually, all but the most simplicistic editors have a setting for that.
It's more a question of finding and activating that setting, less a
question of the proper editor to use.

(I agree that Geany is a fine editor though.)

Comer

unread,
Apr 17, 2012, 2:18:19 PM4/17/12
to sy...@googlegroups.com
Hi Chris,

I was able to get my editor to help me see the errors of my indentions (does this put me in danger of becoming indentured??).  As you say, I was doing a mix of tabs and spaces and found all those tabs and removed them, replacing what needed changing with spaces, as the ./bin/test requires.  I now have the dual_matrix method tests passing, along with the others (anti_symmetric matrix and det_lu_decomposition).  So I have pushed the code to github and ask those in the know to take a look.

Thanks for your help.

Comer

Comer

unread,
Apr 17, 2012, 2:26:17 PM4/17/12
to sy...@googlegroups.com
Hi Joachim,

Thanks for the suggestions.  I am now working on my macbook pro and am using TextWrangler.  This editor has (no surprise) a setting to let me see both spaces and tabs in a py file. Using that I was able to finally see where the aberrant things were. Also, as you point out it is more than just that. But as a result of fixing the tabs/space issues, I was more easily able to see the  code errors, as the tests did not run after the tabs/spaces business was fixed. I found the errors and now all runs fine.

I am a linux guy. My other machine is a debian linux machine. On that I have used drpython, which is nice in that it checks syntax and did show some problems. But its internal facility for converting tabs to spaces does not work in the version I have, so I reverted back to the Mac and sorted it out with TextWrangler.  

Do you know if geany is available for the mac Lion?  If so I will give it a try.

Thanks.

Comer

Comer

unread,
Apr 17, 2012, 2:28:30 PM4/17/12
to sy...@googlegroups.com
Hi Alan,

I think geany is not available for debian linux.  We have talked about this some time ago and that is when I settled on using drpython, although I am not totally happy with it.

I will go take another look for geany for debian linux.

Comer
To unsubscribe from this group, send email to sympy+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Joachim Durchholz

unread,
Apr 17, 2012, 2:53:37 PM4/17/12
to sy...@googlegroups.com
Am 17.04.2012 20:26, schrieb Comer:
> Do you know if geany is available for the mac Lion? If so I will give it a
> try.

I have no idea, but googling gave me this:
http://wiki.geany.org/howtos/osx/running

Joachim Durchholz

unread,
Apr 17, 2012, 2:56:34 PM4/17/12
to sy...@googlegroups.com
Am 17.04.2012 20:28, schrieb Comer:
> Hi Alan,
>
> I think geany is not available for debian linux.

http://packages.debian.org/search?keywords=geany claims the opposite.
(I can't verify, I'm running Ubuntu, which offers more packages than
Debian.)

Alan Bromborsky

unread,
Apr 17, 2012, 3:00:50 PM4/17/12
to sy...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/A7RQZK_ezIwJ.

To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Chris Smith

unread,
Apr 17, 2012, 11:01:47 PM4/17/12
to sy...@googlegroups.com
On Wed, Apr 18, 2012 at 12:03 AM, Comer <comer....@gmail.com> wrote:
> Hi Chris,
>
> I was able to get my editor to help me see the errors of my indentions (does
> this put me in danger of becoming indentured??).  As you say, I was doing a
> mix of tabs and spaces and found all those tabs and removed them, replacing
> what needed changing with spaces, as the ./bin/test requires.  I now have
> the dual_matrix method tests passing, along with the others (anti_symmetric
> matrix and det_lu_decomposition).  So I have pushed the code to github and
> ask those in the know to take a look.
>

It doesn't appear to have been pushed. The last commit is from 6 days
ago (and the cheatsheet is still missing).

/c

Comer

unread,
Apr 18, 2012, 9:04:16 AM4/18/12
to sy...@googlegroups.com
Hi Chris,

Umm.  Here is what I just tried on my local machine:

[homelap-3:~/sympy] comerduncan% pwd
/Users/comerduncan/sympy
[homelap-3:~/sympy] comerduncan% git branch
  master
* test1
[homelap-3:~/sympy] comerduncan% git push github test1
Everything up-to-date

Also, I just checked the contents of my test1 branch at github and the cheatsheet.tex file is present and the changes I have on my local machine are present.  

Perhaps I am overlooking something?

Comer

Chris Smith

unread,
Apr 18, 2012, 12:02:34 PM4/18/12
to sy...@googlegroups.com
On Wed, Apr 18, 2012 at 6:49 PM, Comer <comer....@gmail.com> wrote:
> Hi Chris,
>
> Umm.  Here is what I just tried on my local machine:
>
> [homelap-3:~/sympy] comerduncan% pwd
> /Users/comerduncan/sympy
> [homelap-3:~/sympy] comerduncan% git branch
>   master
> * test1
> [homelap-3:~/sympy] comerduncan% git push github test1
> Everything up-to-date
>
> Also, I just checked the contents of my test1 branch at github and the
> cheatsheet.tex file is present and the changes I have on my local machine
> are present.
>
> Perhaps I am overlooking something?
>

Ahh, you pushed to your current working branch, not the one that is in
the pull request (47b923f). So if you delete branch 47b923f (git
branch -D 47b923f) and then from your test1 branch do (git checkout -b
47b923f) it will create a clone of your test1 branch. If you then push
that (git push -f github 47b923f) it will update the pull request.

Comer

unread,
Apr 18, 2012, 3:48:36 PM4/18/12
to sy...@googlegroups.com
I am having a problem with the deletion of 47b923f.  Here is what I do on my local machine in my sympy directory (branch test1):

[ComerMacPro:~] comerduncan% cd sympy
[ComerMacPro:~/sympy] comerduncan% git branch
  master
* test1
[ComerMacPro:~/sympy] comerduncan% git branch -D 47b923f
error: branch '47b923f' not found.

So, what gives?  Sorry.

Comer 

Chris Smith

unread,
Apr 18, 2012, 11:44:03 PM4/18/12
to sy...@googlegroups.com
>
> [ComerMacPro:~] comerduncan% cd sympy
> [ComerMacPro:~/sympy] comerduncan% git branch
>   master
> * test1
> [ComerMacPro:~/sympy] comerduncan% git branch -D 47b923f
> error: branch '47b923f' not found.
>
> So, what gives?  Sorry.

You can't delete the branch you are on :-) move to master first.

Comer

unread,
Apr 19, 2012, 8:51:34 AM4/19/12
to sy...@googlegroups.com
Hi Chris,
Well, ok:).  However, note

[ComerMacPro:~/sympy] comerduncan% git branch
  master
* test1
[ComerMacPro:~/sympy] comerduncan% git checkout master
Checking out files: 100% (53/53), done.
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 10 commits.
[ComerMacPro:~/sympy] comerduncan% git branch
* master
  test1
[ComerMacPro:~/sympy] comerduncan% git branch -D 47b923f
error: branch '47b923f' not found.

I must have things very screwed up...

Comer 

Sergiu Ivanov

unread,
Apr 19, 2012, 9:19:20 AM4/19/12
to sy...@googlegroups.com

I have been keeping about half an eye on this conversation lately, so
I'm absolutely out of topic, but I'll still try.

"47b923f" looks like a commit hash rather than a branch name.
Moreover, git branch shows that you don't have a branch with this
name, so my guess is that you don't need to delete it :-)

I'm now looking at the pull request
https://github.com/sympy/sympy/pull/1229 , is this the one the
discussion is about?

Judging from what I see there, it looks like you've sent a pull
request not from a *branch*, but from a *commit*. [0] says that it's
possible:

Pull requests can be sent from any branch or commit but it’s
recommended that a topic branch be used so that follow-up commits
can be pushed to update the pull request if necessary.

As far as I understand the situation, you will *not* now be able to
update the pull request #1229.

The cleanest way out I envision is to close the pull request #1229 and
to submit a new pull request, this time from the branch test1. To
submit this new pull request, you will have to ensure that test1 on
GitHub contains all your latest changes, then select "test1" in the
little drop-down to the left of the tab "Files" and under the clone
URLs, and finally click the "Pull Request" button immediately under
you GitHub ID (top-right corner of the page).

There *may* be other solutions, my experience with GitHub is not that
extensive yet, so feel free to wait for other to react as well :-)

Sergiu

[0] http://help.github.com/send-pull-requests/

P.S. I added emphatic asterisks not to shout, but to stress key points
:-)

Matthew Rocklin

unread,
Apr 19, 2012, 9:25:57 AM4/19/12
to sy...@googlegroups.com
It looks like Comer's master branch doesn't match sympy's master branch (I.e. I think he has added some commits to his master.)  What is the best way for him to correct this?

--
You received this message because you are subscribed to the Google Groups "sympy" group.

Sergiu Ivanov

unread,
Apr 19, 2012, 9:36:05 AM4/19/12
to sy...@googlegroups.com
On Thu, Apr 19, 2012 at 4:25 PM, Matthew Rocklin <mroc...@gmail.com> wrote:
> It looks like Comer's master branch doesn't match sympy's master branch
> (I.e. I think he has added some commits to his master.)  What is the best
> way for him to correct this?

From what I can see https://github.com/comer/sympy/commits/master ,
Comer's master is behind SymPy's master, but it doesn't diverge. In
this case one of the proper ways to go would be to update the master
branch and then rebase test1 on top of the new master:

# Update master
git checkout master
git pull <SymPy remote name> master

# Rebase test1
git rebase -i master test1

# Update both branches on GitHub
git push <your own remote name> master test1

It should be possible to find out the exact names of <SymPy remote
name> and <your own remote name> by running git remote show.

Sergiu

P.S. I'm providing skeleton overviews; don't hesitate to ask
questions. I hope I'll have the knowledge to answer them :-)

Chris Smith

unread,
Apr 19, 2012, 10:11:52 AM4/19/12
to sy...@googlegroups.com

git's pretty forgiving. You apparently made changes in the master. If
you do "git log" you can see what those changes are and then decide if
you should keep them (in which case you can just create a new branch
with "git branch my_new_branch"). If you just want to get back your
clean master then move to a different branch (like your test1 branch)
and then do "git checkout -b master --track origin/master".

If you don't want to see the whole commit message when you look at
commits, try "git log --oneline" which will give you a one line view.

Others may have better suggestions...but that's how I do it.

/c

Comer

unread,
Apr 19, 2012, 1:13:49 PM4/19/12
to sy...@googlegroups.com
Hi Sergiu,

I am trying to use your suggested steps.  Here is what I am experiencing:

[homelap-3:~/sympy] comerduncan% git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 10 commits.
[homelap-3:~/sympy] comerduncan% git remote show
github
origin
[homelap-3:~/sympy] comerduncan% man git-remote
[homelap-3:~/sympy] comerduncan% pwd
/Users/comerduncan/sympy
[homelap-3:~/sympy] comerduncan% git checkout master
Already on 'master'
Your branch is ahead of 'origin/master' by 10 commits.
[homelap-3:~/sympy] comerduncan% git pull github master
From github.com:comer/sympy
 * branch            master     -> FETCH_HEAD
Already up-to-date.
[homelap-3:~/sympy] comerduncan% git branch
* master
  test1
[homelap-3:~/sympy] comerduncan% git rebase -i master test1
error: could not apply d5da8bd... fixed indention problems with matrices.py and content problems with test_matrices.py both having to do with addition of dual_matrix method
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' and run 'git rebase --continue'
Could not apply d5da8bd... fixed indention problems with matrices.py and content problems with test_matrices.py both having to do with addition of dual_matrix method

I got an editor window which I saved and then exited from the editor (TextWrangler).  I do not know the value of <paths> so can not do the git add <paths> step.  

Comer

Joachim Durchholz

unread,
Apr 19, 2012, 1:34:07 PM4/19/12
to sy...@googlegroups.com
Am 19.04.2012 19:13, schrieb Comer:
> [homelap-3:~/sympy] comerduncan% git rebase -i master test1
> error: could not apply d5da8bd... fixed indention problems with matrices.py
> and content problems with test_matrices.py both having to do with addition
> of dual_matrix method
> hint: after resolving the conflicts, mark the corrected paths
> hint: with 'git add<paths>' and run 'git rebase --continue'
> Could not apply d5da8bd... fixed indention problems with matrices.py and
> content problems with test_matrices.py both having to do with addition of
> dual_matrix method

That last message shouldn't have come twice. I'm not sure what's going
on, from a really messed-up commit history to a copy&paste mistake,
everything is possible.

> I got an editor window which I saved and then exited from the editor
> (TextWrangler).

Sounds like you tried a git commit somewhere.
git should also have listed those files that have a conflict. You can
get that list anytime by issuing git status.

(BTW git branch will tell you you're not on any branch while a rebase is
in progress, that's normal.)

> I do not know the value of<paths> so can not do the git
> add<paths> step.

That's the filename, with enough directory name components to identify
it from the current directory.

Sergiu Ivanov

unread,
Apr 19, 2012, 1:41:47 PM4/19/12
to sy...@googlegroups.com
On Thu, Apr 19, 2012 at 8:13 PM, Comer <comer....@gmail.com> wrote:
>
> I am trying to use your suggested steps.  Here is what I am experiencing:
>
> [homelap-3:~/sympy] comerduncan% git checkout master
> Switched to branch 'master'
> Your branch is ahead of 'origin/master' by 10 commits.
> [homelap-3:~/sympy] comerduncan% git remote show
> github
> origin
> [homelap-3:~/sympy] comerduncan% man git-remote
> [homelap-3:~/sympy] comerduncan% pwd
> /Users/comerduncan/sympy
> [homelap-3:~/sympy] comerduncan% git checkout master
> Already on 'master'
> Your branch is ahead of 'origin/master' by 10 commits.
> [homelap-3:~/sympy] comerduncan% git pull github master
> From github.com:comer/sympy
>  * branch            master     -> FETCH_HEAD
> Already up-to-date.

As a side remark, this means that the branch master in your repository
does not diverge from the master in SymPy, as opposed to what we
suspected.

> [homelap-3:~/sympy] comerduncan% git branch
> * master
>   test1
> [homelap-3:~/sympy] comerduncan% git rebase -i master test1
> error: could not apply d5da8bd... fixed indention problems with matrices.py
> and content problems with test_matrices.py both having to do with addition
> of dual_matrix method
> hint: after resolving the conflicts, mark the corrected paths
> hint: with 'git add <paths>' and run 'git rebase --continue'
> Could not apply d5da8bd... fixed indention problems with matrices.py and
> content problems with test_matrices.py both having to do with addition of
> dual_matrix method
>
> I got an editor window which I saved and then exited from the editor
> (TextWrangler).  I do not know the value of <paths> so can not do the git
> add <paths> step.

All of this is normal. Rebasing is an operation which basically takes
all your new commits in test1 and tries to put them on top of the new
master. The result is stored in test1 only, the master stays the
same.

When git tried to put the commit "d5da8bd... fixed indention problems
with matrices.py" on top of master, it encountered a merge conflict.
[0] may provide you some additional information. Presently, the
rebase process is in a hiatus. You cannot use the repository for
anything else but for continuing your rebase now. *Should* you want
to abort rebasing and return to the state of affairs as it were at the
beginning, do

git rebase --abort

Now, to see where in which files exactly the merge conflict occurred,
run

git status

You should then edit the corresponding files to resolve the merge
conflicts. When you have resolved them, do

git add <file1> <file2> ... <file n>

where <file i> are the names of files you have edited to resolve the
conflict.

After that, to continue rebasing, do

git rebase --continue

Git will show you an editor in which you will be able to edit the old
commit message, if you want. It will then try to go on rebasing the
other commits in your branch. Shall you encounter merge conflicts
again, the procedure will be exactly the same.

Sergiu

[0] http://schacon.github.com/git/user-manual.html#resolving-a-merge

Sergiu Ivanov

unread,
Apr 19, 2012, 1:48:30 PM4/19/12
to sy...@googlegroups.com
On Thu, Apr 19, 2012 at 8:34 PM, Joachim Durchholz <j...@durchholz.org> wrote:
> Am 19.04.2012 19:13, schrieb Comer:
>
>> [homelap-3:~/sympy] comerduncan% git rebase -i master test1
>> error: could not apply d5da8bd... fixed indention problems with
>> matrices.py
>> and content problems with test_matrices.py both having to do with addition
>> of dual_matrix method
>> hint: after resolving the conflicts, mark the corrected paths
>> hint: with 'git add<paths>' and run 'git rebase --continue'
>> Could not apply d5da8bd... fixed indention problems with matrices.py and
>> content problems with test_matrices.py both having to do with addition of
>> dual_matrix method
>
>
> That last message shouldn't have come twice. I'm not sure what's going on,
> from a really messed-up commit history to a copy&paste mistake, everything
> is possible.

Indeed, that message shouldn't have appeared twice.

I'm not a Git expert, but I did mess things up seriously a couple
times. My humble experience tells me that in such situations Git
would react much more nervously that just repeating a message. So, I
have three possible interpretations:

* copy-and-paste mistake, disregardable,

* Git works slightly differently on Comer's laptop, disregardable,

* Git itself is severely broken, which seems unlikely, judging by the
output we have been shown.

Neither of these provides an explanation, but they help me rest
relatively calm :-)

>> I got an editor window which I saved and then exited from the editor
>> (TextWrangler).
>
>
> Sounds like you tried a git commit somewhere.

No, the editor window appeared because I specified the -i option to
git-rebase, which triggered the interactive mode and made Git ask for
an explicit list of commits, which Comer has accepted.

> git should also have listed those files that have a conflict. You can get
> that list anytime by issuing git status.

From what I remember, Git doesn't show that list for me when reporting
a conflict; I can only see the list of files with conflict in git
status.

Sergiu

Comer

unread,
Apr 20, 2012, 11:35:14 AM4/20/12
to sy...@googlegroups.com
Hi,

Given that things are somewhat screwed up and given that there are only two files which were changed in the process (sympy/matrices/matrices.py and sympy/matrices/tests/test_matrices.py) I am now thinking it would be simpler to 

1. cp the two files somewhere for safe keeping.

2. get a clean clone of sympy from github and put it in a new directory away from the diseased tree.

3. make a new branch off the new clone and call it comer-sympy

4. move my two files back into place.

5. do a git add and git commit of those two files.

6. close the #1229 pull request.

7. open a new pull request.

8. apologise for wasting people's time

Do you have any suggestions for changes or some revisions to the details of the above steps?

Thanks for everyone's patience.

Comer

Chris Smith

unread,
Apr 20, 2012, 1:02:22 PM4/20/12
to sy...@googlegroups.com
On Fri, Apr 20, 2012 at 9:20 PM, Comer <comer....@gmail.com> wrote:
> Hi,
>
> Given that things are somewhat screwed up and given that there are only two
> files which were changed in the process (sympy/matrices/matrices.py and
> sympy/matrices/tests/test_matrices.py) I am now thinking it would be simpler
> to
>
> 1. cp the two files somewhere for safe keeping.
>

This works as long as nobody has changed the files since you worked on
them, otherwise you end up having to sort out the changes. It's better
if you can just copy the functions that were changed. BUT...

I really don't think this is necessary. Regardless of how the branch
got named, github thinks the name of the branch that got pushed is
47b923f . Let it think so. Just go to your test1 branch and make a
copy named 47b923f and push it to github:

git checkout test1
git checkout -b 47b923f
git push -f comer 47b923f

I squashed all your commits into one and can confirm that they rebase
on master without problem and contain only changes to 4 files. I'll
push that squashed branch and make a few comments there so you can see
them (https://github.com/sympy/sympy/pull/1253 ).

> 2. get a clean clone of sympy from github and put it in a new directory away
> from the diseased tree.

I don't think you have a problem (based on my clone of your repo).
Make sure, however, that your prompt is set to show you exactly where
you are, e.g. here's what mine looks like:

chriss@CHRIS-LT ~/sympy (test1)
$ git checkout head~1
Note: checking out 'head~1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 3215b20... Add Angadh Nanjangud to AUTHORS/aboutus. Welcome to Sy
mPy!

chriss@CHRIS-LT ~/sympy ((3215b20...))

Notice how the SHA1 is shown rather than the branch name...this is
what tells me that I am not at the branch head.

> 6. close the #1229 pull request.

If what I suggested above works, this won't be necessary.

>
> 8. apologise for wasting people's time
>

You learn and we all learn how to help people. It's a win-win. No problem :-)

Reply all
Reply to author
Forward
0 new messages