mercurial/commands.py
changeset 4516 96d8a56d4ef9
parent 4505 0ca5ef554987
child 4523 b9d311928caf
equal deleted inserted replaced
4515:86a66cce9566 4516:96d8a56d4ef9
   899         a = "1\n2\n3\n4\n"
   899         a = "1\n2\n3\n4\n"
   900         b = "1\n2\n3\ninsert\n4\n"
   900         b = "1\n2\n3\ninsert\n4\n"
   901         fa = writetemp(a)
   901         fa = writetemp(a)
   902         d = mdiff.unidiff(a, None, b, None, os.path.basename(fa))
   902         d = mdiff.unidiff(a, None, b, None, os.path.basename(fa))
   903         fd = writetemp(d)
   903         fd = writetemp(d)
   904         
   904 
   905         files = {}
   905         files = {}
   906         try:
   906         try:
   907             patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
   907             patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
   908         except util.Abort, e:
   908         except util.Abort, e:
   909             ui.write(_(" patch call failed:\n"))
   909             ui.write(_(" patch call failed:\n"))
   910             ui.write(" " + str(e) + "\n")
   910             ui.write(" " + str(e) + "\n")
   911             problems += 1
   911             problems += 1
   912         else:            
   912         else:
   913             if list(files) != [os.path.basename(fa)]:
   913             if list(files) != [os.path.basename(fa)]:
   914                 ui.write(_(" unexpected patch output!"))
   914                 ui.write(_(" unexpected patch output!"))
   915                 ui.write(_(" (you may have an incompatible version of patch)\n"))
   915                 ui.write(_(" (you may have an incompatible version of patch)\n"))
   916                 problems += 1
   916                 problems += 1
   917             a = file(fa).read()
   917             a = file(fa).read()
   918             if a != b:
   918             if a != b:
   919                 ui.write(_(" patch test failed!"))
   919                 ui.write(_(" patch test failed!"))
   920                 ui.write(_(" (you may have an incompatible version of patch)\n"))
   920                 ui.write(_(" (you may have an incompatible version of patch)\n"))
   921                 problems += 1
   921                 problems += 1
   922                 
   922 
   923         os.unlink(fa)
   923         os.unlink(fa)
   924         os.unlink(fd)
   924         os.unlink(fd)
   925 
   925 
   926     # merge helper
   926     # merge helper
   927     ui.status(_("Checking merge helper...\n"))
   927     ui.status(_("Checking merge helper...\n"))
  2546     l = repo.tagslist()
  2546     l = repo.tagslist()
  2547     l.reverse()
  2547     l.reverse()
  2548     hexfunc = ui.debugflag and hex or short
  2548     hexfunc = ui.debugflag and hex or short
  2549     for t, n in l:
  2549     for t, n in l:
  2550         try:
  2550         try:
  2551 	    hn = hexfunc(n)
  2551             hn = hexfunc(n)
  2552             r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n))
  2552             r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n))
  2553         except revlog.LookupError:
  2553         except revlog.LookupError:
  2554             r = "    ?:%s" % hn
  2554             r = "    ?:%s" % hn
  2555         if ui.quiet:
  2555         if ui.quiet:
  2556             ui.write("%s\n" % t)
  2556             ui.write("%s\n" % t)