Comments
Patch
========================================
@@ -274,6 +274,13 @@
def has_msys():
return os.getenv('MSYSTEM')
+def has_multiproc():
+ # ignore Windows environment
+ try:
+ return 1 < int(os.sysconf('SC_NPROCESSORS_ONLN'))
+ except (AttributeError, ValueError):
+ return False
+
checks = {
"true": (lambda: True, "yak shaving"),
"false": (lambda: False, "nail clipper"),
@@ -296,6 +303,7 @@
"inotify": (has_inotify, "inotify extension support"),
"killdaemons": (has_killdaemons, 'killdaemons.py support'),
"lsprof": (has_lsprof, "python lsprof module"),
+ "multiproc": (has_multiproc, "multi processor"),
"mtn": (has_mtn, "monotone client (>= 1.0)"),
"outer-repo": (has_outer_repo, "outer repo"),
"p4": (has_p4, "Perforce server and client"),
@@ -0,0 +1,81 @@
+ $ "$TESTDIR/hghave" multiproc || exit 80
+
+ $ hg init update-collision
+ $ cd update-collision
+
+ $ cat > setupfiles.py <<EOF
+ > import os, sys
+ > os.mkdir(sys.argv[1])
+ > for x in xrange(50): # "50" may have to be bigger for reproductivity ?
+ > f = open('%s/%04d' % (sys.argv[1], x), 'w')
+ > f.write(str(x))
+ > f.close()
+ > EOF
+
+ $ python setupfiles.py a
+ $ echo b > b
+ $ hg add -q a b
+ $ hg commit -m 'add b (0)'
+
+ $ hg remove -q a b
+ $ hg commit -m 'remove b (1)'
+
+ $ mkdir b
+ $ echo b/b > b/b
+ $ python setupfiles.py c
+ $ hg add -q b c
+ $ hg commit -m 'add b/b (2)'
+
+ $ hg remove -q b/b
+ $ mkdir d
+ $ echo d/d > d/d
+ $ hg add -q d
+ $ hg commit -m 'add d/d, remove b/b (3)'
+
+ $ hg -q remove c d
+ $ hg commit -m 'remove d/d (4)'
+
+ $ echo d > d
+ $ python setupfiles.py e
+ $ hg add -q d e
+ $ hg commit -m 'add d (5)'
+
+ $ hg update -q -C 0 --config worker.numcpus=1
+ $ hg status -A b
+ C b
+
+ $ cat > wrap.py <<EOF
+ > from mercurial import extensions, worker
+ >
+ > def worthwhile(orgfnc, ui, costperop, nops):
+ > return True # to reproduce collision easily
+ > def uisetup(ui):
+ > extensions.wrapfunction(worker, 'worthwhile', worthwhile)
+ > EOF
+
+| 'actions' should consist of below actions in this order:
+|
+| - removing 'a' x N + 'b'
+| - updating 'b/b' + 'c' x N
+|
+| this causes updating 'b/b' before removing 'b', because "numcpus=2"
+| locate the former at the top of the queue on the second worker.
+
+ $ hg update -q -C 2 --config extensions.wrap=wrap.py --config worker.numcpus$
+ $ hg status -A b/b
+ C b/b
+
+ $ hg update -q -C 3 --config worker.numcpus=1
+ $ hg status -A d/d
+ C d/d
+
+| 'actions' should consist of below in actions this order:
+|
+| - removing 'c' x N + 'd/d'
+| - updating 'd' + 'e' x N
+
+ $ hg update -q -C 5 --config extensions.wrap=wrap.py --config worker.numcpus$
+ $ hg status -A d
+ C d
+
+ $ cd ..