Mercurial > hg-stable
view tests/test-committer.t @ 25774:4f8c20fe66f0
shelve: keep old backups if timestamp can't decide exact order of them
Before this patch, backups to be discarded are decided by steps below
at 'hg unshelve' or so:
1. list '(st_mtime, filename)' tuples of each backups up
2. sort list of these tuples, and
3. discard backups other than 'maxbackups' ones at the end of list
This doesn't work well in the case below:
- "sort by name" order differs from actual backup-ing order, and
- some of backups have same timestamp
For example, 'test-shelve.t' satisfies the former condition:
- 'default-01' < 'default-1' in "sort by name" order
- 'default-1' < 'default-01' in actual backup-ing order
Then, 'default-01' is discarded instead of 'default-1' unexpectedly,
if they have same timestamp. This failure appears occasionally,
because the most important condition "same timestamp" is timing
critical.
To avoid such unexpected discarding, this patch keeps old backups if
timestamp can't decide exact order of them.
Timestamp of the border backup (= the oldest one of recent
'maxbackups' ones) as 'bordermtime' is used to examine whether
timestamp can decide exact order of backups.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 13 Jul 2015 23:34:12 +0900 |
parents | 6dfb78f18bdb |
children | 89003c49315c |
line wrap: on
line source
$ unset HGUSER $ EMAIL="My Name <myname@example.com>" $ export EMAIL $ hg init test $ cd test $ touch asdf $ hg add asdf $ hg commit -m commit-1 $ hg tip changeset: 0:53f268a58230 tag: tip user: My Name <myname@example.com> date: Thu Jan 01 00:00:00 1970 +0000 summary: commit-1 $ unset EMAIL $ echo 1234 > asdf $ hg commit -u "foo@bar.com" -m commit-1 $ hg tip changeset: 1:3871b2a9e9bf tag: tip user: foo@bar.com date: Thu Jan 01 00:00:00 1970 +0000 summary: commit-1 $ echo "[ui]" >> .hg/hgrc $ echo "username = foobar <foo@bar.com>" >> .hg/hgrc $ echo 12 > asdf $ hg commit -m commit-1 $ hg tip changeset: 2:8eeac6695c1c tag: tip user: foobar <foo@bar.com> date: Thu Jan 01 00:00:00 1970 +0000 summary: commit-1 $ echo 1 > asdf $ hg commit -u "foo@bar.com" -m commit-1 $ hg tip changeset: 3:957606a725e4 tag: tip user: foo@bar.com date: Thu Jan 01 00:00:00 1970 +0000 summary: commit-1 $ echo 123 > asdf $ echo "[ui]" > .hg/hgrc $ echo "username = " >> .hg/hgrc $ hg commit -m commit-1 abort: no username supplied (use "hg config --edit" to set your username) [255] # test alternate config var $ echo 1234 > asdf $ echo "[ui]" > .hg/hgrc $ echo "user = Foo Bar II <foo2@bar.com>" >> .hg/hgrc $ hg commit -m commit-1 $ hg tip changeset: 4:6f24bfb4c617 tag: tip user: Foo Bar II <foo2@bar.com> date: Thu Jan 01 00:00:00 1970 +0000 summary: commit-1 # test no .hg/hgrc (uses generated non-interactive username) $ echo space > asdf $ rm .hg/hgrc $ hg commit -m commit-1 2>&1 no username found, using '[^']*' instead (re) $ echo space2 > asdf $ hg commit -u ' ' -m commit-1 transaction abort! rollback completed abort: empty username! [255] # don't add tests here, previous test is unstable $ cd ..