##// END OF EJS Templates
revlog: extract function for getting node from known-to-exist rev...
revlog: extract function for getting node from known-to-exist rev Many of the calls to index_node() (which converts a rev to a nodeid) are done with a rev that's know to exist. If the function fails, there's something really wrong and we should just abort. This was done in only one place. This patch starts by extracting that code to a function that we can reuse in later patches. Differential Revision: https://phab.mercurial-scm.org/D3456

File last commit:

r36799:ffa3026d default
r37877:a91f31a1 default
Show More
svn-safe-append.py
28 lines | 562 B | text/x-python | PythonLexer
/ tests / svn-safe-append.py
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 #!/usr/bin/env python
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 from __future__ import absolute_import
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 __doc__ = """Same as `echo a >> b`, but ensures a changed mtime of b.
Without this svn will not detect workspace changes."""
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 import os
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 import stat
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 import sys
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439
text = sys.argv[1]
fname = sys.argv[2]
f = open(fname, "ab")
try:
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 before = os.fstat(f.fileno())[stat.ST_MTIME]
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 f.write(text)
f.write("\n")
finally:
f.close()
inc = 1
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 now = os.stat(fname)[stat.ST_MTIME]
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 while now == before:
t = now + inc
inc += 1
os.utime(fname, (t, t))
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 now = os.stat(fname)[stat.ST_MTIME]