Changeset 10885 in genesis for tools


Ignore:
Timestamp:
May 16, 2012, 8:56:46 PM (13 years ago)
Author:
rick
Message:

Handmatig(!) opruimen van alle conflict keys.

Related-To: nodefactory:ticket:218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10884 r10885  
    13391339  else:
    13401340    return "NO"
     1341
     1342def rlinput(prompt, prefill=''):
     1343   import readline
     1344   readline.set_startup_hook(lambda: readline.insert_text(prefill))
     1345   try:
     1346      return raw_input(prompt)
     1347   finally:
     1348      readline.set_startup_hook()
     1349
     1350def fix_conflict(left, right, default='i'):
     1351  while True:
     1352    print "## %-30s | %-30s" % (left, right)
     1353    c = raw_input("## Solve Conflict (h for help) <l|r|e|i|> [%s]: " % default)
     1354    if not c:
     1355      c = default
     1356
     1357    if c in ['l','1']:
     1358      return left
     1359    elif c in ['r','2']:
     1360      return right
     1361    elif c in ['e', '3']:
     1362      return rlinput("Edit: ", "%30s | %30s" % (left, right))
     1363    elif c in ['i', '4']:
     1364      return None
     1365    else:
     1366      print "#ERROR: '%s' is invalid input (left, right, edit or ignore)!" % c
    13411367
    13421368def main():
     
    15131539           
    15141540
    1515             if datadump[iface_key].has_key('desc') and datadump[iface_key]['comment'].lower() == datadump[iface_key]['desc'].lower():
    1516               del datadump[iface_key]['desc']
     1541            if datadump[iface_key].has_key('desc'):
     1542              if datadump[iface_key]['comment'].lower() == datadump[iface_key]['desc'].lower():
     1543                del datadump[iface_key]['desc']
     1544              else:
     1545                print "# ERROR: At %s - %s" % (datadump['nodename'], iface_key)
     1546                response = fix_conflict(datadump[iface_key]['comment'], datadump[iface_key]['desc'])
     1547                if response:
     1548                  datadump[iface_key]['comment'] = response
     1549                  del datadump[iface_key]['desc']
    15171550
    15181551            # Set the compass value based on the angle between the poels
Note: See TracChangeset for help on using the changeset viewer.