##// END OF EJS Templates
obsolescence: add test case B-6 for obsolescence markers exchange...
obsolescence: add test case B-6 for obsolescence markers exchange About 3 years ago, in August 2014, the logic to select what markers to select on push was ported from the evolve extension to Mercurial core. However, for some unclear reasons, the tests for that logic were not ported alongside. I realised it a couple of weeks ago while working on another push related issue. I've made a clean up pass on the tests and they are now ready to integrate the core test suite. This series of changesets do not change any logic. I just adds test for logic that has been around for about 10 versions of Mercurial. They are a patch for each test case. It makes it easier to review and postpone one with documentation issues without rejecting the wholes series. This patch introduce case B6: Pruned changeset with precursors not in pushed set Each test case comes it in own test file. It help parallelism and does not introduce a significant overhead from having a single unified giant test file. Here are timing to support this claim. # Multiple test files version: # run-tests.py --local -j 1 test-exchange-*.t 53.40s user 6.82s system 85% cpu 1:10.76 total 52.79s user 6.97s system 85% cpu 1:09.97 total 52.94s user 6.82s system 85% cpu 1:09.69 total # Single test file version: # run-tests.py --local -j 1 test-exchange-obsmarkers.t 52.97s user 6.85s system 85% cpu 1:10.10 total 52.64s user 6.79s system 85% cpu 1:09.63 total 53.70s user 7.00s system 85% cpu 1:11.17 total

File last commit:

r31339:7c09b071 default
r31918:68dc2eca default
Show More
scmposix.py
79 lines | 2.1 KiB | text/x-python | PythonLexer
Gregory Szorc
scmposix: use absolute_import
r27483 from __future__ import absolute_import
Yuya Nishihara
scmutil: narrow ImportError handling in termwidth()...
r30311 import array
Yuya Nishihara
scmutil: move util.termwidth()...
r30309 import errno
import fcntl
Gregory Szorc
scmposix: use absolute_import
r27483 import os
import sys
from . import (
Pulkit Goyal
py3: make scmposix.userrcpath() return bytes...
r30276 encoding,
Gregory Szorc
scmposix: use absolute_import
r27483 osutil,
Pulkit Goyal
py3: use pycompat.sysargv in scmposix.systemrcpath()...
r30467 pycompat,
Gregory Szorc
scmposix: use absolute_import
r27483 )
Kevin Bullock
scmutil: split platform-specific bits into their own modules...
r18690
def _rcfiles(path):
rcs = [os.path.join(path, 'hgrc')]
rcdir = os.path.join(path, 'hgrc.d')
try:
rcs.extend([os.path.join(rcdir, f)
for f, kind in osutil.listdir(rcdir)
if f.endswith(".rc")])
except OSError:
pass
return rcs
def systemrcpath():
path = []
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 if pycompat.sysplatform == 'plan9':
Kevin Bullock
scmutil: split platform-specific bits into their own modules...
r18690 root = 'lib/mercurial'
else:
root = 'etc/mercurial'
# old mod_python does not set sys.argv
if len(getattr(sys, 'argv', [])) > 0:
Pulkit Goyal
py3: use pycompat.sysargv in scmposix.systemrcpath()...
r30467 p = os.path.dirname(os.path.dirname(pycompat.sysargv[0]))
Mads Kiilerich
config: don't read the same config file twice...
r22583 if p != '/':
path.extend(_rcfiles(os.path.join(p, root)))
Kevin Bullock
scmutil: split platform-specific bits into their own modules...
r18690 path.extend(_rcfiles('/' + root))
return path
def userrcpath():
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 if pycompat.sysplatform == 'plan9':
Pulkit Goyal
py3: make scmposix.userrcpath() return bytes...
r30276 return [encoding.environ['home'] + '/lib/hgrc']
David Demelier
hg: allow usage of XDG_CONFIG_HOME/hg/hgrc...
r30941 elif pycompat.sysplatform == 'darwin':
return [os.path.expanduser('~/.hgrc')]
Kevin Bullock
scmutil: split platform-specific bits into their own modules...
r18690 else:
David Demelier
hg: allow usage of XDG_CONFIG_HOME/hg/hgrc...
r30941 confighome = encoding.environ.get('XDG_CONFIG_HOME')
if confighome is None or not os.path.isabs(confighome):
confighome = os.path.expanduser('~/.config')
return [os.path.expanduser('~/.hgrc'),
os.path.join(confighome, 'hg', 'hgrc')]
Yuya Nishihara
scmutil: move util.termwidth()...
r30309
Yuya Nishihara
scmutil: extend termwidth() to return terminal height, renamed to termsize()...
r30314 def termsize(ui):
Yuya Nishihara
scmutil: move util.termwidth()...
r30309 try:
import termios
Yuya Nishihara
scmutil: narrow ImportError handling in termwidth()...
r30311 TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449)
except (AttributeError, ImportError):
Yuya Nishihara
scmutil: extend termwidth() to return terminal height, renamed to termsize()...
r30314 return 80, 24
Yuya Nishihara
scmutil: remove superfluous indent from termwidth()
r30312
for dev in (ui.ferr, ui.fout, ui.fin):
try:
Yuya Nishihara
scmutil: move util.termwidth()...
r30309 try:
Yuya Nishihara
scmutil: remove superfluous indent from termwidth()
r30312 fd = dev.fileno()
except AttributeError:
continue
if not os.isatty(fd):
continue
arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8)
Pulkit Goyal
smcposix: pass unicode as first argument to array.array...
r31339 height, width = array.array(r'h', arri)[:2]
Yuya Nishihara
scmutil: extend termwidth() to return terminal height, renamed to termsize()...
r30314 if width > 0 and height > 0:
return width, height
Yuya Nishihara
scmutil: remove superfluous indent from termwidth()
r30312 except ValueError:
pass
except IOError as e:
if e[0] == errno.EINVAL:
Yuya Nishihara
scmutil: move util.termwidth()...
r30309 pass
Yuya Nishihara
scmutil: remove superfluous indent from termwidth()
r30312 else:
raise
Yuya Nishihara
scmutil: extend termwidth() to return terminal height, renamed to termsize()...
r30314 return 80, 24