code: def git_sequence_editor_squash(fpath):
      r
      import utool as ut
      text = ut.read_from(fpath)
      print(text)
      prev_msg = None
      prev_dt = None
      new_lines = []
      def get_commit_date(hashid):
          out, err, ret = ut.cmd('git show -s --format=%ci ' + hashid, verbose=False, quiet=True, pad_stdout=False)
          from dateutil import parser
          stamp = out.strip('\n')
          dt = parser.parse(stamp)
          return dt
      for line in text.split('\n'):
          commit_line = line.split(' ')
          if len(commit_line) < 3:
              prev_msg = None
              prev_dt = None
              new_lines += [line]
              continue
          action = commit_line[0]
          hashid = commit_line[1]
          msg = ' ' .join(commit_line[2:])
          try:
              dt = get_commit_date(hashid)
          except ValueError:
              prev_msg = None
              prev_dt = None
              new_lines += [line]
              continue
          orig_msg = msg
          can_squash = action == 'pick' and msg == 'wip' and prev_msg == 'wip'
          if prev_dt is not None and prev_msg == 'wip':
              tdelta = dt - prev_dt
              threshold_minutes = 45
              td_min = (tdelta.total_seconds() / 60.)
              can_squash &= td_min < threshold_minutes
              msg = msg + ' -- tdelta=%r' % (ut.get_timedelta_str(tdelta),)
          if can_squash:
              new_line = ' ' .join(['squash', hashid, msg])
              new_lines += [new_line]
          else:
              new_lines += [line]
          prev_msg = orig_msg
          prev_dt = dt
      new_text = '\n'.join(new_lines)
      def get_commit_date(hashid):
          out = ut.cmd('git show -s --format=%ci ' + hashid, verbose=False)
          print('out = %r' % (out,))
      print(new_text)
      ut.write_to(fpath, new_text, n=None)