Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8.1, 0.8.2, and 0.8.3

hgtk: verify hg version is with our suggested range

Fixes #366, sort of.. about as well as we can.

Changeset 1460eb80053c

Parent 3a2b59afd222

by Steve Borho

Changes to one file · Browse files at 1460eb80053c Showing diff from parent 3a2b59afd222 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​hgtk.py Stacked
 
214
215
216
 
217
218
219
 
569
570
571
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
573
574
 
214
215
216
217
218
219
220
 
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
@@ -214,6 +214,7 @@
  raise hglib.RepoError(_("There is no Mercurial repository here"   " (.hg not found)"))   + checkhgversion(hglib.hgversion)   try:   return func(ui, *args, **cmdoptions)   except TypeError, inst: @@ -569,6 +570,26 @@
  else:   ui.write("%s\n" % first)   +def checkhgversion(v): + """range check the Mercurial version""" + # this is a series of hacks, but Mercurial's versioning scheme + # doesn't lend itself to a "correct" solution. This will at least + # catch people who have old Mercurial packages. + reqver = ['1', '2'] + if not v or v == 'unknown' or len(v) == 12: + # can't make any intelligent decisions about unknown or hashes + return + vers = v.split('.')[:2] + if vers == reqver: + return + nextver = list(reqver) + nextver[1] = chr(ord(reqver[1])+1) + if vers == nextver: + return + raise util.Abort(_('This version of TortoiseHg requires Mercurial ' + 'version %s.n to %s.n') % ('.'.join(reqver), + '.'.join(nextver))) +  def version(ui, **opts):   """output version and copyright information"""   ui.write(_('TortoiseHg Dialogs (version %s), '