tests/svn-safe-append.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 01 Jun 2014 00:08:33 +0900
changeset 21714 635a8201e356
parent 6439 c1b47c0fd2b6
child 29195 bdba6a2015d0
permissions -rwxr-xr-x
qfold: allow to specify '--message/'--logfile' and '--edit' at the same time Before this patch, 'hg qfold' disallows to specify '--message/'--logfile' and '--edit' at the same time. 'hg qfold' has disallowed such combination since Mercurial 0.9.2, but this restriction seems not to be reasonable for recent Mercurial, because all other commands creating new changeset allow it. This patch allows 'hg qfold' to specify '--message/'--logfile' and '--edit' at the same time like other commands creating new changeset.

#!/usr/bin/env python

__doc__ = """Same as `echo a >> b`, but ensures a changed mtime of b.
Without this svn will not detect workspace changes."""

import sys, os

text = sys.argv[1]
fname = sys.argv[2]

f = open(fname, "ab")
try:
    before = os.fstat(f.fileno()).st_mtime
    f.write(text)
    f.write("\n")
finally:
    f.close()
inc = 1
now = os.stat(fname).st_mtime
while now == before:
    t = now + inc
    inc += 1
    os.utime(fname, (t, t))
    now = os.stat(fname).st_mtime