Skip to content
This repository

Fix AttributeError on merge conflict #70

Merged
merged 1 commit into from almost 2 years ago

2 participants

Jens Knutson Kenneth Reitz
Jens Knutson
jensck commented June 06, 2012

Whenever I get a merge conflict, legit pukes up an exception as in the example below.

Since black() looks to be expecting a str, let's give it one.

$ legit sync
Pulling commits from the server.
Error: Merge failed. Reverting.
Traceback (most recent call last):
  File "/usr/bin/legit", line 9, in 
    load_entry_point('legit==0.1.1', 'console_scripts', 'legit')()
  File "/usr/lib/python2.7/site-packages/legit/cli.py", line 45, in main
    cmd_map.get(arg).__call__(args)
  File "/usr/lib/python2.7/site-packages/legit/cli.py", line 158, in cmd_sync
    status_log(smart_pull, 'Pulling commits from the server.')
  File "/usr/lib/python2.7/site-packages/legit/cli.py", line 80, in status_log
    log = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/legit/scm.py", line 119, in smart_pull
    return smart_merge('{0}/{1}'.format(remote, branch))
  File "/usr/lib/python2.7/site-packages/legit/scm.py", line 140, in smart_merge
    abort('Merge failed. Reverting.', log=why)
  File "/usr/lib/python2.7/site-packages/legit/scm.py", line 42, in abort
    settings.abort_handler(a)
  File "/usr/lib/python2.7/site-packages/legit/cli.py", line 489, in handle_abort
    print black(aborted.log)
  File "/usr/lib/python2.7/site-packages/legit/cli.py", line 29, in black
    return s.encode('utf-8')
AttributeError: 'GitCommandError' object has no attribute 'encode'
Kenneth Reitz
Owner

thanks!

Kenneth Reitz kennethreitz merged commit 6f5c1df into from June 18, 2012
Kenneth Reitz kennethreitz closed this June 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jun 06, 2012
Jens Knutson Fix AttributeError on merge conflict 9c360f0
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  legit/cli.py
2  legit/cli.py
@@ -507,7 +507,7 @@ def display_version():
507 507
 
508 508
 def handle_abort(aborted):
509 509
     print colored.red('Error:'), aborted.message
510  
-    print black(aborted.log)
  510
+    print black(str(aborted.log))
511 511
     print 'Unfortunately, there was a merge conflict. It has to be merged manually.'
512 512
     sys.exit(1)
513 513
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.