Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.1, 2.0.2, and 2.0.3

stable csinfo: do not abort on ctx.user() for working context (closes #202)

Calling ctx.user() aborts for the working context if no username has
been set in mercurial's config.

Changeset e72139488071

Parent c6ad5c7ed8ef

by Adrian Buehlmann

Changes to 2 files · Browse files at e72139488071 Showing diff from parent c6ad5c7ed8ef Diff from another changeset...

 
138
139
140
141
 
142
143
 
144
145
146
 
138
139
140
 
141
142
 
143
144
145
146
@@ -138,9 +138,9 @@
  return None   return hglib.tounicode(value)[:80]   elif item == 'user': - return hglib.tounicode(ctx.user()) + return hglib.tounicode(hglib.user(ctx))   elif item == 'shortuser': - return hglib.tounicode(hglib.username(ctx.user())) + return hglib.tounicode(hglib.username(hglib.user(ctx)))   elif item == 'dateage':   date = self.get_data('date', *args)   age = self.get_data('age', *args)
 
23
24
25
26
 
27
28
29
 
520
521
522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
524
525
 
23
24
25
 
26
27
28
29
 
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
@@ -23,7 +23,7 @@
 demandimport.enable()    from mercurial import ui, util, extensions, match, bundlerepo, url, cmdutil -from mercurial import dispatch, encoding, templatefilters, filemerge +from mercurial import dispatch, encoding, templatefilters, filemerge, error    _encoding = encoding.encoding  _encodingmode = encoding.encodingmode @@ -520,6 +520,22 @@
  author = util.shortuser(user)   return author   +def user(ctx): + ''' + Get the username of the change context. Does not abort and just returns + an empty string if ctx is a working context and no username has been set + in mercurial's config. + ''' + try: + user = ctx.user() + except error.Abort: + if ctx._rev is not None: + raise + # ctx is a working context and probably no username has + # been configured in mercurial's config + user = '' + return user +  def get_revision_desc(fctx, curpath=None):   """return the revision description as a string"""   author = tounicode(username(fctx.user()))