mercurial/commands.py
changeset 13751 85d74f6babf6
parent 13747 cede00420e1e
child 13767 0f9282dc87f8
equal deleted inserted replaced
13750:7eb82f88e157 13751:85d74f6babf6
  1556         templater.templater(templater.templatepath("map-cmdline.default"))
  1556         templater.templater(templater.templatepath("map-cmdline.default"))
  1557     except Exception, inst:
  1557     except Exception, inst:
  1558         ui.write(" %s\n" % inst)
  1558         ui.write(" %s\n" % inst)
  1559         ui.write(_(" (templates seem to have been installed incorrectly)\n"))
  1559         ui.write(_(" (templates seem to have been installed incorrectly)\n"))
  1560         problems += 1
  1560         problems += 1
  1561 
       
  1562     # patch
       
  1563     ui.status(_("Checking patch...\n"))
       
  1564     patchproblems = 0
       
  1565     a = "1\n2\n3\n4\n"
       
  1566     b = "1\n2\n3\ninsert\n4\n"
       
  1567     fa = writetemp(a)
       
  1568     d = mdiff.unidiff(a, None, b, None, os.path.basename(fa),
       
  1569         os.path.basename(fa))
       
  1570     fd = writetemp(d)
       
  1571 
       
  1572     files = {}
       
  1573     try:
       
  1574         patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
       
  1575     except util.Abort, e:
       
  1576         ui.write(_(" patch call failed:\n"))
       
  1577         ui.write(" " + str(e) + "\n")
       
  1578         patchproblems += 1
       
  1579     else:
       
  1580         if list(files) != [os.path.basename(fa)]:
       
  1581             ui.write(_(" unexpected patch output!\n"))
       
  1582             patchproblems += 1
       
  1583         a = open(fa).read()
       
  1584         if a != b:
       
  1585             ui.write(_(" patch test failed!\n"))
       
  1586             patchproblems += 1
       
  1587 
       
  1588     if patchproblems:
       
  1589         if ui.config('ui', 'patch'):
       
  1590             ui.write(_(" (Current patch tool may be incompatible with patch,"
       
  1591                        " or misconfigured. Please check your configuration"
       
  1592                        " file)\n"))
       
  1593         else:
       
  1594             ui.write(_(" Internal patcher failure, please report this error"
       
  1595                        " to http://mercurial.selenic.com/wiki/BugTracker\n"))
       
  1596     problems += patchproblems
       
  1597 
       
  1598     os.unlink(fa)
       
  1599     os.unlink(fd)
       
  1600 
  1561 
  1601     # editor
  1562     # editor
  1602     ui.status(_("Checking commit editor...\n"))
  1563     ui.status(_("Checking commit editor...\n"))
  1603     editor = ui.geteditor()
  1564     editor = ui.geteditor()
  1604     cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0])
  1565     cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0])