Mercurial > hgsubversion
annotate tests/fixtures/rename-closed-branch-dir.sh @ 1550:67b28d657f62
sqliterevmap: break ".hashes()" cycle in a safer way
The `fromsvn()` revset implementation could cause weakref error when using
sqliterevmap like:
File "hgsubversion/util.py", line 357, in <lambda>
return subset.filter(lambda r: tonode(r) in hashes)
File "hgsubversion/maps.py", line 542, in __contains__
return self.get(key) != None
File "hgsubversion/maps.py", line 533, in get
for row in self.revmap._query(
ReferenceError: weakly-referenced object no longer exists
Basically the seemingly harmless assignment could break surprisingly:
# dangerous: `hashes` does not have a reference of `meta.revmap` and may
# become unavailable after `meta`, `revmap` being released by refcount.
hashes = meta.revmap.hashes()
The above syntax is nice to support while avoiding cycles is also nice.
This patch removes `revmap._hashes` so the revmap no longer owns a reference
of a `ReverseRevMap` object so the `ReverseRevMap` object no longer needs to
use weakref for `self.revmap`.
This could actually be caught by `comprehensive/test_sqlite_revmap.py`.
I was not careful enough verifying the "fromsvn()" patch.
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 21 Dec 2017 17:39:52 -0800 |
parents | b072dc02d1e3 |
children |
rev | line source |
---|---|
1373
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
1 #!/bin/sh |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
2 # |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
3 # Generate rename-closed-branch-dir.svndump |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
4 # |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
5 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
6 mkdir temp |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
7 cd temp |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
8 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
9 mkdir project |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
10 cd project |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
11 mkdir trunk |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
12 mkdir branches |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
13 mkdir tags |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
14 cd .. |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
15 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
16 svnadmin create testrepo |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
17 CURRENT_DIR=`pwd` |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
18 svnurl=file://"$CURRENT_DIR"/testrepo |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
19 #svn import project-orig $svnurl -m "init project" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
20 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
21 svn co $svnurl project |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
22 cd project |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
23 svn add * |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
24 svn ci -m "init project" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
25 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
26 cd trunk |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
27 echo a > a.txt |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
28 svn add a.txt |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
29 svn ci -m "add a.txt in trunk" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
30 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
31 # Create a branch |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
32 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
33 cd ../branches |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
34 svn copy ../trunk async-db |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
35 svn ci -m "add branch async-db" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
36 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
37 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
38 # Implement feature |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
39 cd async-db |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
40 echo b > b.txt |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
41 svn add b.txt |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
42 svn ci -m "Async functionality" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
43 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
44 # Merge feature branch |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
45 cd ../../trunk |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
46 svn merge $svnurl/branches/async-db |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
47 svn ci -m "Merged branch async-db" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
48 cd .. |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
49 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
50 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
51 # Create branch folder for unnecessary branches |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
52 svn mkdir $svnurl/branches/dead -m "Create branch folder for unnecessary branches" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
53 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
54 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
55 # We don't need the 'async-db' branch, anymore. |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
56 svn copy $svnurl/branches/async-db $svnurl/branches/dead -m "We don't need the 'async-db' branch, anymore." |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
57 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
58 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
59 # Rename 'dead' folder to 'closed' |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
60 svn move $svnurl/branches/dead $svnurl/branches/closed -m "Renamed 'dead' folder to 'closed'" |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
61 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
62 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
63 # Move 'branches/closed' to 'tags/closed' |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
64 svn move $svnurl/branches/closed $svnurl/tags/closed -m "Moved 'branches/closed' to 'tags/closed'." |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
65 svn up |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
66 |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
67 # Dump repository |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
68 cd .. |
b072dc02d1e3
rename-closed-branch-dir: add a fixture that renames a directory of closed branches
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
69 svnadmin dump testrepo > ../rename-closed-branch-dir.svndump |