@@ -121,8 +121,8 @@ def diffact(sender):
121
121
try :
122
122
difftxt = [x ['diff' ] for x in self .g .diff_working () if x ['new' ]['path' ]== str (self .list [section ][row ])]
123
123
sys .stdout .write (difftxt [0 ])
124
- except ValueError ,KeyError :
125
- print 'uhhhh'
124
+ except ( ValueError ,KeyError ) :
125
+ console . hud_alert ( 'could not create a diff, for some strange reason!' )
126
126
def diffacthtml (sender ,difftype = git_diff .source .PATH ):
127
127
f = git_diff .diff_working (self ._repo (),str (self .list [section ][row ]),difftype )
128
128
w = ui .WebView (frame = self .view .frame )
@@ -289,7 +289,7 @@ def _get_last_committer(self):
289
289
elif last_commit .committer :
290
290
author ,author_email = (last_commit .committer .split ('>' )[0 ]+ '<' ).split ('<' )[0 :2 ]
291
291
return author ,author_email
292
- except KeyError , AttributeError :
292
+ except ( KeyError , AttributeError ) :
293
293
return '' ,''
294
294
def commit (self ,sender ):
295
295
if list (itertools .chain (* porcelain .status (self .g .path ).staged .itervalues ())):
@@ -388,7 +388,7 @@ def remote_for_head(self):
388
388
head = self ._repo ().head ()
389
389
remote , remote_branch = [ k .split ('/' )[- 2 :] for k ,v in refs if v == head and k .startswith ('refs/remotes' )][0 ]
390
390
return remote ,remote_branch
391
- except IndexError , KeyError :
391
+ except ( IndexError , KeyError ) :
392
392
return '' ,''
393
393
394
394
def checkout (self ,sender ):
@@ -420,7 +420,9 @@ def clone(self,clonedict):
420
420
remote = clonedict ['remote url' ]
421
421
local = clonedict ['local path' ]
422
422
repo_name = os .path .join (self .view ['repo' ].base , local )
423
-
423
+ if not local :
424
+ console .hud_alert ('you must define a local path' ,'error' )
425
+ return
424
426
if remote :
425
427
try :
426
428
repo = Gittle .clone (remote , repo_name , bare = False )
@@ -432,14 +434,18 @@ def clone(self,clonedict):
432
434
self .view ['repo' ].txt = repo_name
433
435
self .refresh ()
434
436
except Exception as e :
435
- console .hud_alert (e .message )
437
+ console .hud_alert (e .message , 'error' )
436
438
437
439
def clone_action (self ,sender ):
438
440
d = UIDialog (root = self .view ,title = 'Clone repo' ,items = {'remote url' :'https://github.com/' ,'local path' :'' },ok_action = self .clone )
439
441
440
442
def new_action (self ,sender ):
441
443
def ok (somedict ):
442
- self .init_repo (somedict ['repo name' ])
444
+ reponame = somedict ['repo name' ]
445
+ if reponame :
446
+ self .init_repo (reponame )
447
+ else :
448
+ console .hud_alert ('No repo created, name was blank!' ,'error' )
443
449
d = UIDialog (root = self .view ,title = 'Clone repo' ,items = {'repo name' :'' },ok_action = ok )
444
450
445
451
def pull (self ):
@@ -526,6 +532,18 @@ def resetPW(self,sender):
526
532
console .hud_alert ('removed password for {}@{}' .format ( user ,netloc ))
527
533
except KeyError :
528
534
console .hud_alert ('no saved auth for {}' .format ( netloc ))
535
+ def log_action (self ,sender ):
536
+ import StringIO
537
+ s = StringIO .StringIO ()
538
+ w = ui .WebView (frame = self .view .frame )
539
+ w .name = 'Log'
540
+ porcelain .log (self ._repo ().path , outstream = s )
541
+ log = s .getvalue ()
542
+ log = log .replace ('\n ' ,'<p>' )
543
+ #print log
544
+ w .load_html (log )
545
+ w .present ('popover' )
546
+
529
547
def auth_urllib2_opener (config , top_level_url , username , password ):
530
548
if config is not None :
531
549
proxy_server = config .get ("http" , "proxy" )
@@ -556,8 +574,6 @@ def auth_urllib2_opener(config, top_level_url, username, password):
556
574
return opener
557
575
558
576
559
-
560
-
561
577
r = repoView ()
562
578
v = ui .load_view ('gitui' )
563
579
r .view = v
@@ -576,6 +592,7 @@ def auth_urllib2_opener(config, top_level_url, username, password):
576
592
v ['clone' ].action = r .clone_action
577
593
v ['new' ].action = r .new_action
578
594
v ['resetPW' ].action = r .resetPW
595
+ v ['log' ].action = r .log_action
579
596
#load current repo
580
597
editorpath = os .path .split (editor .get_path ())[0 ]
581
598
if editorpath .startswith ('/var' ):
0 commit comments