mercurial/commands.py
changeset 638 35f7adfefa69
parent 635 85e2209d401c
child 639 31cebba881a0
equal deleted inserted replaced
637:31e090c34d3b 638:35f7adfefa69
   878         def respond(v):
   878         def respond(v):
   879             fout.write("%d\n" % len(v))
   879             fout.write("%d\n" % len(v))
   880             fout.write(v)
   880             fout.write(v)
   881             fout.flush()
   881             fout.flush()
   882 
   882 
       
   883         lock = None
       
   884 
   883         while 1:
   885         while 1:
   884             cmd = fin.readline()[:-1]
   886             cmd = fin.readline()[:-1]
   885             if cmd == '':
   887             if cmd == '':
   886                 return
   888                 return
   887             if cmd == "heads":
   889             if cmd == "heads":
   888                 h = repo.heads()
   890                 h = repo.heads()
   889                 respond(" ".join(map(hg.hex, h)) + "\n")
   891                 respond(" ".join(map(hg.hex, h)) + "\n")
       
   892             if cmd == "lock":
       
   893                 lock = repo.lock()
       
   894                 respond("")
       
   895             if cmd == "unlock":
       
   896                 if lock: lock.release()
       
   897                 lock = None
       
   898                 respond("")
   890             elif cmd == "branches":
   899             elif cmd == "branches":
   891                 arg, nodes = getarg()
   900                 arg, nodes = getarg()
   892                 nodes = map(hg.bin, nodes.split(" "))
   901                 nodes = map(hg.bin, nodes.split(" "))
   893                 r = []
   902                 r = []
   894                 for b in repo.branches(nodes):
   903                 for b in repo.branches(nodes):