2014-08-06 20:43:59 +04:00
|
|
|
#require cvs
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
$ cvscall()
|
|
|
|
> {
|
|
|
|
> cvs -f "$@"
|
|
|
|
> }
|
|
|
|
$ hgcat()
|
|
|
|
> {
|
|
|
|
> hg --cwd src-hg cat -r tip "$1"
|
|
|
|
> }
|
|
|
|
$ echo "[extensions]" >> $HGRCPATH
|
|
|
|
$ echo "convert = " >> $HGRCPATH
|
|
|
|
$ cat > cvshooks.py <<EOF
|
|
|
|
> def cvslog(ui,repo,hooktype,log):
|
|
|
|
> print "%s hook: %d entries"%(hooktype,len(log))
|
|
|
|
>
|
|
|
|
> def cvschangesets(ui,repo,hooktype,changesets):
|
|
|
|
> print "%s hook: %d changesets"%(hooktype,len(changesets))
|
|
|
|
> EOF
|
|
|
|
$ hookpath=`pwd`
|
2014-11-04 17:41:46 +03:00
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
|
|
> [hooks]
|
|
|
|
> cvslog = python:$hookpath/cvshooks.py:cvslog
|
|
|
|
> cvschangesets = python:$hookpath/cvshooks.py:cvschangesets
|
|
|
|
> EOF
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
create cvs repository
|
|
|
|
|
|
|
|
$ mkdir cvsrepo
|
|
|
|
$ cd cvsrepo
|
|
|
|
$ CVSROOT=`pwd`
|
|
|
|
$ export CVSROOT
|
|
|
|
$ CVS_OPTIONS=-f
|
|
|
|
$ export CVS_OPTIONS
|
|
|
|
$ cd ..
|
2014-12-28 23:30:52 +03:00
|
|
|
$ rmdir cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
$ cvscall -q -d "$CVSROOT" init
|
|
|
|
|
|
|
|
create source directory
|
|
|
|
|
|
|
|
$ mkdir src-temp
|
|
|
|
$ cd src-temp
|
|
|
|
$ echo a > a
|
|
|
|
$ mkdir b
|
|
|
|
$ cd b
|
|
|
|
$ echo c > c
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
import source directory
|
|
|
|
|
|
|
|
$ cvscall -q import -m import src INITIAL start
|
|
|
|
N src/a
|
|
|
|
N src/b/c
|
|
|
|
|
|
|
|
No conflicts created by this import
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
checkout source directory
|
|
|
|
|
|
|
|
$ cvscall -q checkout src
|
|
|
|
U src/a
|
|
|
|
U src/b/c
|
|
|
|
|
|
|
|
commit a new revision changing b/c
|
|
|
|
|
|
|
|
$ cd src
|
|
|
|
$ sleep 1
|
|
|
|
$ echo c >> b/c
|
|
|
|
$ cvscall -q commit -mci0 . | grep '<--'
|
2010-10-09 07:36:10 +04:00
|
|
|
$TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
convert fresh repo and also check localtimezone option
|
2010-09-26 23:50:58 +04:00
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
NOTE: This doesn't check all time zones -- it merely determines that
|
|
|
|
the configuration option is taking effect.
|
|
|
|
|
|
|
|
An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
|
|
|
|
since it does not use DST (unlike other U.S. time zones) and is always
|
|
|
|
a fixed difference from UTC.
|
|
|
|
|
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
|
2010-09-26 23:50:58 +04:00
|
|
|
initializing destination src-hg repository
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
5 log entries
|
|
|
|
cvslog hook: 5 entries
|
|
|
|
creating changesets
|
|
|
|
3 changeset entries
|
|
|
|
cvschangesets hook: 3 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
2 Initial revision
|
2012-12-14 02:15:51 +04:00
|
|
|
1 ci0
|
|
|
|
0 import
|
2010-09-26 23:50:58 +04:00
|
|
|
updating tags
|
|
|
|
$ hgcat a
|
|
|
|
a
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
|
|
|
|
convert fresh repo with --filemap
|
|
|
|
|
|
|
|
$ echo include b/c > filemap
|
|
|
|
$ hg convert --filemap filemap src src-filemap
|
|
|
|
initializing destination src-filemap repository
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
5 log entries
|
|
|
|
cvslog hook: 5 entries
|
|
|
|
creating changesets
|
|
|
|
3 changeset entries
|
|
|
|
cvschangesets hook: 3 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
2 Initial revision
|
2012-12-14 02:15:51 +04:00
|
|
|
1 ci0
|
|
|
|
0 import
|
2010-09-26 23:50:58 +04:00
|
|
|
filtering out empty revision
|
convert: apply the appropriate phases to the destination (issue4165)
If the conversion doesn't change the hash, and the cset is public in the source,
it should be public in the destination. (This can happen if file remapping is
done that doesn't affect the initial commits.) This also propagates the secret
phase from the source, regardless of the hash, because presumably the content is
what is secret. Otherwise, the destination commit stays in the draft phase.
Maybe any draft cset with an unchanged hash should be changed to public, because
it has effectively been shared, but convert pretty strongly implies throwing
away (or at least readonly archiving) the source repo.
The change in the rollback output is because the name of the outer transaction
is now 'convert', which seems more accurate. Unfortunately, the memctx won't
indicate the hash prior to committing, so the proper phase can't be applied with
the commit.
The repo is already write locked in mercurial_sink.before().
2015-06-14 20:08:11 +03:00
|
|
|
repository tip rolled back to revision 1 (undo convert)
|
2010-09-26 23:50:58 +04:00
|
|
|
updating tags
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
$ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
|
|
|
|
2 update tags files: .hgtags
|
|
|
|
1 ci0 files: b/c
|
|
|
|
0 Initial revision files: b/c
|
|
|
|
|
|
|
|
convert full repository (issue1649)
|
|
|
|
|
|
|
|
$ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
|
|
|
|
U srcfull/src/a
|
|
|
|
U srcfull/src/b/c
|
|
|
|
$ ls srcfull
|
|
|
|
CVS
|
|
|
|
CVSROOT
|
|
|
|
src
|
|
|
|
$ hg convert srcfull srcfull-hg \
|
|
|
|
> | grep -v 'log entries' | grep -v 'hook:' \
|
|
|
|
> | grep -v '^[0-3] .*' # filter instable changeset order
|
|
|
|
initializing destination srcfull-hg repository
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
creating changesets
|
|
|
|
4 changeset entries
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
updating tags
|
2012-06-21 01:41:21 +04:00
|
|
|
$ hg cat -r tip --cwd srcfull-hg src/a
|
2010-09-26 23:50:58 +04:00
|
|
|
a
|
2012-06-21 01:41:21 +04:00
|
|
|
$ hg cat -r tip --cwd srcfull-hg src/b/c
|
2010-09-26 23:50:58 +04:00
|
|
|
c
|
|
|
|
c
|
|
|
|
|
|
|
|
commit new file revisions
|
|
|
|
|
|
|
|
$ cd src
|
|
|
|
$ echo a >> a
|
|
|
|
$ echo c >> b/c
|
|
|
|
$ cvscall -q commit -mci1 . | grep '<--'
|
2010-10-09 07:36:10 +04:00
|
|
|
$TESTTMP/cvsrepo/src/a,v <-- a
|
|
|
|
$TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
convert again
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
7 log entries
|
|
|
|
cvslog hook: 7 entries
|
|
|
|
creating changesets
|
|
|
|
4 changeset entries
|
|
|
|
cvschangesets hook: 4 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 ci1
|
|
|
|
$ hgcat a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
|
|
|
|
convert again with --filemap
|
|
|
|
|
|
|
|
$ hg convert --filemap filemap src src-filemap
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
7 log entries
|
|
|
|
cvslog hook: 7 entries
|
|
|
|
creating changesets
|
|
|
|
4 changeset entries
|
|
|
|
cvschangesets hook: 4 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 ci1
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
$ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
|
|
|
|
3 ci1 files: b/c
|
|
|
|
2 update tags files: .hgtags
|
|
|
|
1 ci0 files: b/c
|
|
|
|
0 Initial revision files: b/c
|
|
|
|
|
|
|
|
commit branch
|
|
|
|
|
|
|
|
$ cd src
|
|
|
|
$ cvs -q update -r1.1 b/c
|
|
|
|
U b/c
|
|
|
|
$ cvs -q tag -b branch
|
|
|
|
T a
|
|
|
|
T b/c
|
|
|
|
$ cvs -q update -r branch > /dev/null
|
2015-10-12 15:42:32 +03:00
|
|
|
$ sleep 1
|
2010-09-26 23:50:58 +04:00
|
|
|
$ echo d >> b/c
|
|
|
|
$ cvs -q commit -mci2 . | grep '<--'
|
2010-10-09 07:36:10 +04:00
|
|
|
$TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
convert again
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
8 log entries
|
|
|
|
cvslog hook: 8 entries
|
|
|
|
creating changesets
|
|
|
|
5 changeset entries
|
|
|
|
cvschangesets hook: 5 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 ci2
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
d
|
|
|
|
|
|
|
|
convert again with --filemap
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
$ TZ=US/Hawaii hg convert --config convert.localtimezone=True --filemap filemap src src-filemap
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
8 log entries
|
|
|
|
cvslog hook: 8 entries
|
|
|
|
creating changesets
|
|
|
|
5 changeset entries
|
|
|
|
cvschangesets hook: 5 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
0 ci2
|
|
|
|
$ hgcat b/c
|
|
|
|
c
|
|
|
|
d
|
|
|
|
$ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
|
|
|
|
4 ci2 files: b/c
|
|
|
|
3 ci1 files: b/c
|
|
|
|
2 update tags files: .hgtags
|
|
|
|
1 ci0 files: b/c
|
|
|
|
0 Initial revision files: b/c
|
|
|
|
|
|
|
|
commit a new revision with funny log message
|
|
|
|
|
|
|
|
$ cd src
|
|
|
|
$ sleep 1
|
|
|
|
$ echo e >> a
|
|
|
|
$ cvscall -q commit -m'funny
|
|
|
|
> ----------------------------
|
|
|
|
> log message' . | grep '<--' |\
|
|
|
|
> sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
|
|
|
|
checking in src/a,v
|
|
|
|
|
|
|
|
commit new file revisions with some fuzz
|
|
|
|
|
|
|
|
$ sleep 1
|
|
|
|
$ echo f >> a
|
|
|
|
$ cvscall -q commit -mfuzzy . | grep '<--'
|
2010-10-09 07:36:10 +04:00
|
|
|
$TESTTMP/cvsrepo/src/a,v <-- a
|
2010-09-26 23:50:58 +04:00
|
|
|
$ sleep 4 # the two changes will be split if fuzz < 4
|
|
|
|
$ echo g >> b/c
|
|
|
|
$ cvscall -q commit -mfuzzy . | grep '<--'
|
2010-10-09 07:36:10 +04:00
|
|
|
$TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
convert again
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
$ TZ=US/Hawaii hg convert --config convert.cvsps.fuzz=2 --config convert.localtimezone=True src src-hg
|
2010-10-09 07:36:10 +04:00
|
|
|
connecting to $TESTTMP/cvsrepo
|
2010-09-26 23:50:58 +04:00
|
|
|
scanning source...
|
|
|
|
collecting CVS rlog
|
|
|
|
11 log entries
|
|
|
|
cvslog hook: 11 entries
|
|
|
|
creating changesets
|
|
|
|
8 changeset entries
|
|
|
|
cvschangesets hook: 8 changesets
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
2 funny
|
|
|
|
1 fuzzy
|
|
|
|
0 fuzzy
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg -R src-hg log -G --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n'
|
2012-11-19 02:26:50 +04:00
|
|
|
o 8 (branch) fuzzy date: * -1000 files: b/c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 7 (branch) fuzzy date: * -1000 files: a (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
|
o 6 (branch) funny
|
|
|
|
| ----------------------------
|
2012-11-19 02:26:50 +04:00
|
|
|
| log message date: * -1000 files: a (glob)
|
|
|
|
o 5 (branch) ci2 date: * -1000 files: b/c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 4 () ci1 date: * -1000 files: a b/c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
2012-11-19 02:26:50 +04:00
|
|
|
o 3 () update tags date: * +0000 files: .hgtags (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
2012-12-14 02:15:51 +04:00
|
|
|
| o 2 (INITIAL) import date: * -1000 files: (glob)
|
|
|
|
| |
|
|
|
|
o | 1 () ci0 date: * -1000 files: b/c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|/
|
2012-11-19 02:26:50 +04:00
|
|
|
o 0 () Initial revision date: * -1000 files: a b/c (glob)
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
|
|
|
|
testing debugcvsps
|
|
|
|
|
|
|
|
$ cd src
|
2015-10-07 11:33:52 +03:00
|
|
|
$ hg debugcvsps --fuzz=2 -x >/dev/null
|
|
|
|
|
|
|
|
commit a new revision changing a and removing b/c
|
|
|
|
|
|
|
|
$ cvscall -q update -A
|
|
|
|
U a
|
|
|
|
U b/c
|
|
|
|
$ sleep 1
|
|
|
|
$ echo h >> a
|
|
|
|
$ cvscall -Q remove -f b/c
|
|
|
|
$ cvscall -q commit -mci | grep '<--'
|
|
|
|
$TESTTMP/cvsrepo/src/a,v <-- a
|
|
|
|
$TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
|
|
|
|
|
|
|
|
update and verify the cvsps cache
|
|
|
|
|
|
|
|
$ hg debugcvsps --fuzz=2 -u
|
2010-09-26 23:50:58 +04:00
|
|
|
collecting CVS rlog
|
2015-10-07 11:33:52 +03:00
|
|
|
13 log entries
|
|
|
|
cvslog hook: 13 entries
|
2010-09-26 23:50:58 +04:00
|
|
|
creating changesets
|
2015-10-07 11:33:52 +03:00
|
|
|
11 changeset entries
|
|
|
|
cvschangesets hook: 11 changesets
|
2010-09-26 23:50:58 +04:00
|
|
|
---------------------
|
|
|
|
PatchSet 1
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
|
|
|
Branchpoints: INITIAL
|
|
|
|
Log:
|
|
|
|
Initial revision
|
|
|
|
|
|
|
|
Members:
|
|
|
|
a:INITIAL->1.1
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 2
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
|
|
|
Branchpoints: INITIAL, branch
|
|
|
|
Log:
|
|
|
|
Initial revision
|
|
|
|
|
|
|
|
Members:
|
|
|
|
b/c:INITIAL->1.1
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 3
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: INITIAL
|
|
|
|
Tag: start
|
|
|
|
Log:
|
|
|
|
import
|
|
|
|
|
|
|
|
Members:
|
|
|
|
a:1.1->1.1.1.1
|
|
|
|
b/c:1.1->1.1.1.1
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 4
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
ci0
|
|
|
|
|
|
|
|
Members:
|
|
|
|
b/c:1.1->1.2
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 5
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
cvsps: use a different tiebreaker to avoid flaky test
After adding some sneaky debug printing[0], I determined that this
test flaked when a CVS commit containing two files starts too close to
the end of a second, thus putting file "a" in one second and "b/c" in
the following second. The secondary sort key meant that these changes
sorted in a different order when the timestamps were different than
they did when they matched. As far as I can tell, CVS walks through
the files in a stable order, so by sorting on the filenames in cvsps
we'll get stable output. It's fine for us to switch from sorting on
the branchpoint as a secondary key because this was already the point
when we didn't care, and we're just trying to break ties in a stable
way. It's unclear to be if having the branchpoint present matters
anymore, but it doesn't really hurt to leave it.
With this change in place, I was able to run test-convert-cvs over 650
times in a row without a failure. test-convert-cvcs-synthetic.t
appears to still be flaky, but I don't think it's *worse* than it was
before - just not better (I observed one flaky failure in 200 runs on
that test).
0: The helpful debug hack ended up being this, in case it's useful to
future flaky test assassins:
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -854,6 +854,8 @@ def debugcvsps(ui, *args, **opts):
ui.write(('Branch: %s\n' % (cs.branch or 'HEAD')))
ui.write(('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
','.join(cs.tags) or '(none)')))
+ if cs.comment == 'ci1' and (cs.id == 6) == bool(cs.branchpoints):
+ ui.write('raw timestamp %r\n' % (cs.date,))
if cs.branchpoints:
ui.write(('Branchpoints: %s \n') %
', '.join(sorted(cs.branchpoints)))
2015-03-13 21:20:13 +03:00
|
|
|
Branchpoints: branch
|
2010-09-26 23:50:58 +04:00
|
|
|
Log:
|
|
|
|
ci1
|
|
|
|
|
|
|
|
Members:
|
cvsps: use a different tiebreaker to avoid flaky test
After adding some sneaky debug printing[0], I determined that this
test flaked when a CVS commit containing two files starts too close to
the end of a second, thus putting file "a" in one second and "b/c" in
the following second. The secondary sort key meant that these changes
sorted in a different order when the timestamps were different than
they did when they matched. As far as I can tell, CVS walks through
the files in a stable order, so by sorting on the filenames in cvsps
we'll get stable output. It's fine for us to switch from sorting on
the branchpoint as a secondary key because this was already the point
when we didn't care, and we're just trying to break ties in a stable
way. It's unclear to be if having the branchpoint present matters
anymore, but it doesn't really hurt to leave it.
With this change in place, I was able to run test-convert-cvs over 650
times in a row without a failure. test-convert-cvcs-synthetic.t
appears to still be flaky, but I don't think it's *worse* than it was
before - just not better (I observed one flaky failure in 200 runs on
that test).
0: The helpful debug hack ended up being this, in case it's useful to
future flaky test assassins:
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -854,6 +854,8 @@ def debugcvsps(ui, *args, **opts):
ui.write(('Branch: %s\n' % (cs.branch or 'HEAD')))
ui.write(('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
','.join(cs.tags) or '(none)')))
+ if cs.comment == 'ci1' and (cs.id == 6) == bool(cs.branchpoints):
+ ui.write('raw timestamp %r\n' % (cs.date,))
if cs.branchpoints:
ui.write(('Branchpoints: %s \n') %
', '.join(sorted(cs.branchpoints)))
2015-03-13 21:20:13 +03:00
|
|
|
a:1.1->1.2
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 6
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
ci1
|
|
|
|
|
|
|
|
Members:
|
cvsps: use a different tiebreaker to avoid flaky test
After adding some sneaky debug printing[0], I determined that this
test flaked when a CVS commit containing two files starts too close to
the end of a second, thus putting file "a" in one second and "b/c" in
the following second. The secondary sort key meant that these changes
sorted in a different order when the timestamps were different than
they did when they matched. As far as I can tell, CVS walks through
the files in a stable order, so by sorting on the filenames in cvsps
we'll get stable output. It's fine for us to switch from sorting on
the branchpoint as a secondary key because this was already the point
when we didn't care, and we're just trying to break ties in a stable
way. It's unclear to be if having the branchpoint present matters
anymore, but it doesn't really hurt to leave it.
With this change in place, I was able to run test-convert-cvs over 650
times in a row without a failure. test-convert-cvcs-synthetic.t
appears to still be flaky, but I don't think it's *worse* than it was
before - just not better (I observed one flaky failure in 200 runs on
that test).
0: The helpful debug hack ended up being this, in case it's useful to
future flaky test assassins:
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -854,6 +854,8 @@ def debugcvsps(ui, *args, **opts):
ui.write(('Branch: %s\n' % (cs.branch or 'HEAD')))
ui.write(('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
','.join(cs.tags) or '(none)')))
+ if cs.comment == 'ci1' and (cs.id == 6) == bool(cs.branchpoints):
+ ui.write('raw timestamp %r\n' % (cs.date,))
if cs.branchpoints:
ui.write(('Branchpoints: %s \n') %
', '.join(sorted(cs.branchpoints)))
2015-03-13 21:20:13 +03:00
|
|
|
b/c:1.2->1.3
|
2010-09-26 23:50:58 +04:00
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 7
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: branch
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
ci2
|
|
|
|
|
|
|
|
Members:
|
|
|
|
b/c:1.1->1.1.2.1
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 8
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: branch
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
funny
|
|
|
|
----------------------------
|
|
|
|
log message
|
|
|
|
|
|
|
|
Members:
|
|
|
|
a:1.2->1.2.2.1
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 9
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: branch
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
fuzzy
|
|
|
|
|
|
|
|
Members:
|
|
|
|
a:1.2.2.1->1.2.2.2
|
|
|
|
|
|
|
|
---------------------
|
|
|
|
PatchSet 10
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: branch
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
fuzzy
|
|
|
|
|
|
|
|
Members:
|
|
|
|
b/c:1.1.2.1->1.1.2.2
|
|
|
|
|
2015-10-07 11:33:52 +03:00
|
|
|
---------------------
|
|
|
|
PatchSet 11
|
|
|
|
Date: * (glob)
|
|
|
|
Author: * (glob)
|
|
|
|
Branch: HEAD
|
|
|
|
Tag: (none)
|
|
|
|
Log:
|
|
|
|
ci
|
|
|
|
|
|
|
|
Members:
|
|
|
|
a:1.2->1.3
|
|
|
|
b/c:1.3->1.4(DEAD)
|
|
|
|
|
2010-09-26 23:50:58 +04:00
|
|
|
|
2012-06-11 03:40:51 +04:00
|
|
|
$ cd ..
|
2017-07-10 20:10:04 +03:00
|
|
|
|
|
|
|
Test transcoding CVS log messages (issue5597)
|
|
|
|
=============================================
|
|
|
|
|
|
|
|
To emulate commit messages in (non-ascii) multiple encodings portably,
|
|
|
|
this test scenario writes CVS history file (*,v file) directly via
|
|
|
|
python code.
|
|
|
|
|
|
|
|
Commit messages of version 1.2 - 1.4 use u3042 in 3 encodings below.
|
|
|
|
|
|
|
|
|encoding |byte sequence | decodable as: |
|
|
|
|
| | | utf-8 euc-jp cp932 |
|
|
|
|
+----------+--------------+--------------------+
|
|
|
|
|utf-8 |\xe3\x81\x82 | o x x |
|
|
|
|
|euc-jp |\xa4\xa2 | x o o |
|
|
|
|
|cp932 |\x82\xa0 | x x o |
|
|
|
|
|
|
|
|
$ mkdir -p cvsrepo/transcoding
|
|
|
|
$ python <<EOF
|
|
|
|
> fp = open('cvsrepo/transcoding/file,v', 'w')
|
|
|
|
> fp.write(('''
|
|
|
|
> head 1.4;
|
|
|
|
> access;
|
|
|
|
> symbols
|
|
|
|
> start:1.1.1.1 INITIAL:1.1.1;
|
|
|
|
> locks; strict;
|
|
|
|
> comment @# @;
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.4
|
|
|
|
> date 2017.07.10.00.00.04; author nobody; state Exp;
|
|
|
|
> branches;
|
|
|
|
> next 1.3;
|
|
|
|
> commitid 10059635D016A510FFA;
|
|
|
|
>
|
|
|
|
> 1.3
|
|
|
|
> date 2017.07.10.00.00.03; author nobody; state Exp;
|
|
|
|
> branches;
|
|
|
|
> next 1.2;
|
|
|
|
> commitid 10059635CFF6A4FF34E;
|
|
|
|
>
|
|
|
|
> 1.2
|
|
|
|
> date 2017.07.10.00.00.02; author nobody; state Exp;
|
|
|
|
> branches;
|
|
|
|
> next 1.1;
|
|
|
|
> commitid 10059635CFD6A4D5095;
|
|
|
|
>
|
|
|
|
> 1.1
|
|
|
|
> date 2017.07.10.00.00.01; author nobody; state Exp;
|
|
|
|
> branches
|
|
|
|
> 1.1.1.1;
|
|
|
|
> next ;
|
|
|
|
> commitid 10059635CFB6A4A3C33;
|
|
|
|
>
|
|
|
|
> 1.1.1.1
|
|
|
|
> date 2017.07.10.00.00.01; author nobody; state Exp;
|
|
|
|
> branches;
|
|
|
|
> next ;
|
|
|
|
> commitid 10059635CFB6A4A3C33;
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> desc
|
|
|
|
> @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.4
|
|
|
|
> log
|
|
|
|
> @''' + u'\u3042'.encode('cp932') + ''' (cp932)
|
|
|
|
> @
|
|
|
|
> text
|
|
|
|
> @1
|
|
|
|
> 2
|
|
|
|
> 3
|
|
|
|
> 4
|
|
|
|
> @
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.3
|
|
|
|
> log
|
|
|
|
> @''' + u'\u3042'.encode('euc-jp') + ''' (euc-jp)
|
|
|
|
> @
|
|
|
|
> text
|
|
|
|
> @d4 1
|
|
|
|
> @
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.2
|
|
|
|
> log
|
|
|
|
> @''' + u'\u3042'.encode('utf-8') + ''' (utf-8)
|
|
|
|
> @
|
|
|
|
> text
|
|
|
|
> @d3 1
|
|
|
|
> @
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.1
|
|
|
|
> log
|
|
|
|
> @Initial revision
|
|
|
|
> @
|
|
|
|
> text
|
|
|
|
> @d2 1
|
|
|
|
> @
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> 1.1.1.1
|
|
|
|
> log
|
|
|
|
> @import
|
|
|
|
> @
|
|
|
|
> text
|
|
|
|
> @@
|
|
|
|
> ''').lstrip())
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cvscall -q checkout transcoding
|
|
|
|
U transcoding/file
|
|
|
|
|
|
|
|
Test converting in normal case
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
(filtering by grep in order to check only form of debug messages)
|
|
|
|
|
|
|
|
$ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp,cp932 -q --debug transcoding transcoding-hg | grep 'transcoding by'
|
|
|
|
transcoding by utf-8: 1.1 of file
|
|
|
|
transcoding by utf-8: 1.1.1.1 of file
|
|
|
|
transcoding by utf-8: 1.2 of file
|
|
|
|
transcoding by euc-jp: 1.3 of file
|
|
|
|
transcoding by cp932: 1.4 of file
|
|
|
|
$ hg -R transcoding-hg --encoding utf-8 log -T "{rev}: {desc}\n"
|
|
|
|
5: update tags
|
|
|
|
4: import
|
|
|
|
3: \xe3\x81\x82 (cp932) (esc)
|
|
|
|
2: \xe3\x81\x82 (euc-jp) (esc)
|
|
|
|
1: \xe3\x81\x82 (utf-8) (esc)
|
|
|
|
0: Initial revision
|
|
|
|
$ rm -rf transcoding-hg
|
|
|
|
|
|
|
|
Test converting in error cases
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
unknown encoding in convert.cvsps.logencoding
|
|
|
|
|
|
|
|
$ hg convert --config convert.cvsps.logencoding=foobar -q transcoding transcoding-hg
|
|
|
|
abort: unknown encoding: foobar
|
|
|
|
(check convert.cvsps.logencoding configuration)
|
|
|
|
[255]
|
|
|
|
$ rm -rf transcoding-hg
|
|
|
|
|
|
|
|
no acceptable encoding in convert.cvsps.logencoding
|
|
|
|
|
|
|
|
$ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp -q transcoding transcoding-hg
|
|
|
|
abort: no encoding can transcode CVS log message for 1.4 of file
|
|
|
|
(check convert.cvsps.logencoding configuration)
|
|
|
|
[255]
|
|
|
|
$ rm -rf transcoding-hg
|