##// END OF EJS Templates
tests: fix various test-check-module-imports.t violations...
Augie Fackler -
r36663:7bc33d67 default
parent child Browse files
Show More
@@ -1,74 +1,74 b''
1 (Translations are optional)
1 (Translations are optional)
2
2
3 #if gettext no-outer-repo
3 #if gettext no-outer-repo
4
4
5 Test that translations are compiled and installed correctly.
5 Test that translations are compiled and installed correctly.
6
6
7 Default encoding in tests is "ascii" and the translation is encoded
7 Default encoding in tests is "ascii" and the translation is encoded
8 using the "replace" error handler:
8 using the "replace" error handler:
9
9
10 $ LANGUAGE=pt_BR hg tip
10 $ LANGUAGE=pt_BR hg tip
11 abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
11 abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
12 [255]
12 [255]
13
13
14 Using a more accommodating encoding:
14 Using a more accommodating encoding:
15
15
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
17 abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
17 abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
18 [255]
18 [255]
19
19
20 Different encoding:
20 Different encoding:
21
21
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
23 abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
23 abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
24 [255]
24 [255]
25
25
26 #endif
26 #endif
27
27
28 #if gettext
28 #if gettext
29
29
30 Test keyword search in translated help text:
30 Test keyword search in translated help text:
31
31
32 $ HGENCODING=UTF-8 LANGUAGE=de hg help -k Aktualisiert
32 $ HGENCODING=UTF-8 LANGUAGE=de hg help -k Aktualisiert
33 Themen:
33 Themen:
34
34
35 subrepos Unterarchive
35 subrepos Unterarchive
36
36
37 Befehle:
37 Befehle:
38
38
39 pull Ruft \xc3\x84nderungen von der angegebenen Quelle ab (esc)
39 pull Ruft \xc3\x84nderungen von der angegebenen Quelle ab (esc)
40 update Aktualisiert das Arbeitsverzeichnis (oder wechselt die Version)
40 update Aktualisiert das Arbeitsverzeichnis (oder wechselt die Version)
41
41
42 #endif
42 #endif
43
43
44 Check Mercurial specific translation problems in each *.po files, and
44 Check Mercurial specific translation problems in each *.po files, and
45 tool itself by doctest
45 tool itself by doctest
46
46
47 $ cd "$TESTDIR"/../i18n
47 $ cd "$TESTDIR"/../i18n
48 $ $PYTHON check-translation.py *.po
48 $ $PYTHON check-translation.py *.po
49 $ $PYTHON check-translation.py --doctest
49 $ $PYTHON check-translation.py --doctest
50 $ cd $TESTTMP
50 $ cd $TESTTMP
51
51
52 #if gettext
52 #if gettext
53
53
54 Check i18n cache isn't reused after encoding change:
54 Check i18n cache isn't reused after encoding change:
55
55
56 $ cat > $TESTTMP/encodingchange.py << EOF
56 $ cat > $TESTTMP/encodingchange.py << EOF
57 > from mercurial.i18n import _
57 > from mercurial import encoding, registrar
58 > from mercurial import encoding, registrar
58 > from mercurial.i18n import _
59 > cmdtable = {}
59 > cmdtable = {}
60 > command = registrar.command(cmdtable)
60 > command = registrar.command(cmdtable)
61 > @command(b'encodingchange', norepo=True)
61 > @command(b'encodingchange', norepo=True)
62 > def encodingchange(ui):
62 > def encodingchange(ui):
63 > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
63 > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
64 > encoding.encoding = encode
64 > encoding.encoding = encode
65 > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
65 > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
66 > EOF
66 > EOF
67
67
68 $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
68 $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
69 (?????)
69 (?????)
70 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
70 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
71 (?????)
71 (?????)
72 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
72 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
73
73
74 #endif
74 #endif
@@ -1,1102 +1,1102 b''
1 # Initial setup
1 # Initial setup
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > lfs=
5 > lfs=
6 > [lfs]
6 > [lfs]
7 > # Test deprecated config
7 > # Test deprecated config
8 > threshold=1000B
8 > threshold=1000B
9 > EOF
9 > EOF
10
10
11 $ LONG=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
11 $ LONG=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
12
12
13 # Prepare server and enable extension
13 # Prepare server and enable extension
14 $ hg init server
14 $ hg init server
15 $ hg clone -q server client
15 $ hg clone -q server client
16 $ cd client
16 $ cd client
17
17
18 # Commit small file
18 # Commit small file
19 $ echo s > smallfile
19 $ echo s > smallfile
20 $ echo '**.py = LF' > .hgeol
20 $ echo '**.py = LF' > .hgeol
21 $ hg --config lfs.track='"size(\">1000B\")"' commit -Aqm "add small file"
21 $ hg --config lfs.track='"size(\">1000B\")"' commit -Aqm "add small file"
22 hg: parse error: unsupported file pattern: size(">1000B")
22 hg: parse error: unsupported file pattern: size(">1000B")
23 (paths must be prefixed with "path:")
23 (paths must be prefixed with "path:")
24 [255]
24 [255]
25 $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file"
25 $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file"
26
26
27 # Commit large file
27 # Commit large file
28 $ echo $LONG > largefile
28 $ echo $LONG > largefile
29 $ grep lfs .hg/requires
29 $ grep lfs .hg/requires
30 [1]
30 [1]
31 $ hg commit --traceback -Aqm "add large file"
31 $ hg commit --traceback -Aqm "add large file"
32 $ grep lfs .hg/requires
32 $ grep lfs .hg/requires
33 lfs
33 lfs
34
34
35 # Ensure metadata is stored
35 # Ensure metadata is stored
36 $ hg debugdata largefile 0
36 $ hg debugdata largefile 0
37 version https://git-lfs.github.com/spec/v1
37 version https://git-lfs.github.com/spec/v1
38 oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
38 oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
39 size 1501
39 size 1501
40 x-is-binary 0
40 x-is-binary 0
41
41
42 # Check the blobstore is populated
42 # Check the blobstore is populated
43 $ find .hg/store/lfs/objects | sort
43 $ find .hg/store/lfs/objects | sort
44 .hg/store/lfs/objects
44 .hg/store/lfs/objects
45 .hg/store/lfs/objects/f1
45 .hg/store/lfs/objects/f1
46 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
46 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
47
47
48 # Check the blob stored contains the actual contents of the file
48 # Check the blob stored contains the actual contents of the file
49 $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
49 $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
50 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
50 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
51
51
52 # Push changes to the server
52 # Push changes to the server
53
53
54 $ hg push
54 $ hg push
55 pushing to $TESTTMP/server
55 pushing to $TESTTMP/server
56 searching for changes
56 searching for changes
57 abort: lfs.url needs to be configured
57 abort: lfs.url needs to be configured
58 [255]
58 [255]
59
59
60 $ cat >> $HGRCPATH << EOF
60 $ cat >> $HGRCPATH << EOF
61 > [lfs]
61 > [lfs]
62 > url=file:$TESTTMP/dummy-remote/
62 > url=file:$TESTTMP/dummy-remote/
63 > EOF
63 > EOF
64
64
65 Push to a local non-lfs repo with the extension enabled will add the
65 Push to a local non-lfs repo with the extension enabled will add the
66 lfs requirement
66 lfs requirement
67
67
68 $ grep lfs $TESTTMP/server/.hg/requires
68 $ grep lfs $TESTTMP/server/.hg/requires
69 [1]
69 [1]
70 $ hg push -v | egrep -v '^(uncompressed| )'
70 $ hg push -v | egrep -v '^(uncompressed| )'
71 pushing to $TESTTMP/server
71 pushing to $TESTTMP/server
72 searching for changes
72 searching for changes
73 lfs: found f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b in the local lfs store
73 lfs: found f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b in the local lfs store
74 2 changesets found
74 2 changesets found
75 adding changesets
75 adding changesets
76 adding manifests
76 adding manifests
77 adding file changes
77 adding file changes
78 added 2 changesets with 3 changes to 3 files
78 added 2 changesets with 3 changes to 3 files
79 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
79 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
80 $ grep lfs $TESTTMP/server/.hg/requires
80 $ grep lfs $TESTTMP/server/.hg/requires
81 lfs
81 lfs
82
82
83 # Unknown URL scheme
83 # Unknown URL scheme
84
84
85 $ hg push --config lfs.url=ftp://foobar
85 $ hg push --config lfs.url=ftp://foobar
86 abort: lfs: unknown url scheme: ftp
86 abort: lfs: unknown url scheme: ftp
87 [255]
87 [255]
88
88
89 $ cd ../
89 $ cd ../
90
90
91 # Initialize new client (not cloning) and setup extension
91 # Initialize new client (not cloning) and setup extension
92 $ hg init client2
92 $ hg init client2
93 $ cd client2
93 $ cd client2
94 $ cat >> .hg/hgrc <<EOF
94 $ cat >> .hg/hgrc <<EOF
95 > [paths]
95 > [paths]
96 > default = $TESTTMP/server
96 > default = $TESTTMP/server
97 > EOF
97 > EOF
98
98
99 # Pull from server
99 # Pull from server
100
100
101 Pulling a local lfs repo into a local non-lfs repo with the extension
101 Pulling a local lfs repo into a local non-lfs repo with the extension
102 enabled adds the lfs requirement
102 enabled adds the lfs requirement
103
103
104 $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
104 $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
105 $TESTTMP/server/.hg/requires:lfs
105 $TESTTMP/server/.hg/requires:lfs
106 $ hg pull default
106 $ hg pull default
107 pulling from $TESTTMP/server
107 pulling from $TESTTMP/server
108 requesting all changes
108 requesting all changes
109 adding changesets
109 adding changesets
110 adding manifests
110 adding manifests
111 adding file changes
111 adding file changes
112 added 2 changesets with 3 changes to 3 files
112 added 2 changesets with 3 changes to 3 files
113 new changesets 0ead593177f7:b88141481348
113 new changesets 0ead593177f7:b88141481348
114 (run 'hg update' to get a working copy)
114 (run 'hg update' to get a working copy)
115 $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
115 $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
116 .hg/requires:lfs
116 .hg/requires:lfs
117 $TESTTMP/server/.hg/requires:lfs
117 $TESTTMP/server/.hg/requires:lfs
118
118
119 # Check the blobstore is not yet populated
119 # Check the blobstore is not yet populated
120 $ [ -d .hg/store/lfs/objects ]
120 $ [ -d .hg/store/lfs/objects ]
121 [1]
121 [1]
122
122
123 # Update to the last revision containing the large file
123 # Update to the last revision containing the large file
124 $ hg update
124 $ hg update
125 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
126
126
127 # Check the blobstore has been populated on update
127 # Check the blobstore has been populated on update
128 $ find .hg/store/lfs/objects | sort
128 $ find .hg/store/lfs/objects | sort
129 .hg/store/lfs/objects
129 .hg/store/lfs/objects
130 .hg/store/lfs/objects/f1
130 .hg/store/lfs/objects/f1
131 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
131 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
132
132
133 # Check the contents of the file are fetched from blobstore when requested
133 # Check the contents of the file are fetched from blobstore when requested
134 $ hg cat -r . largefile
134 $ hg cat -r . largefile
135 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
135 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
136
136
137 # Check the file has been copied in the working copy
137 # Check the file has been copied in the working copy
138 $ cat largefile
138 $ cat largefile
139 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
139 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
140
140
141 $ cd ..
141 $ cd ..
142
142
143 # Check rename, and switch between large and small files
143 # Check rename, and switch between large and small files
144
144
145 $ hg init repo3
145 $ hg init repo3
146 $ cd repo3
146 $ cd repo3
147 $ cat >> .hg/hgrc << EOF
147 $ cat >> .hg/hgrc << EOF
148 > [lfs]
148 > [lfs]
149 > track=size(">10B")
149 > track=size(">10B")
150 > EOF
150 > EOF
151
151
152 $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large
152 $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large
153 $ echo SHORTER > small
153 $ echo SHORTER > small
154 $ hg add . -q
154 $ hg add . -q
155 $ hg commit -m 'commit with lfs content'
155 $ hg commit -m 'commit with lfs content'
156
156
157 $ hg files -r . 'set:added()'
157 $ hg files -r . 'set:added()'
158 large
158 large
159 small
159 small
160 $ hg files -r . 'set:added() & lfs()'
160 $ hg files -r . 'set:added() & lfs()'
161 large
161 large
162
162
163 $ hg mv large l
163 $ hg mv large l
164 $ hg mv small s
164 $ hg mv small s
165 $ hg status 'set:removed()'
165 $ hg status 'set:removed()'
166 R large
166 R large
167 R small
167 R small
168 $ hg status 'set:removed() & lfs()'
168 $ hg status 'set:removed() & lfs()'
169 R large
169 R large
170 $ hg commit -m 'renames'
170 $ hg commit -m 'renames'
171
171
172 $ hg files -r . 'set:copied()'
172 $ hg files -r . 'set:copied()'
173 l
173 l
174 s
174 s
175 $ hg files -r . 'set:copied() & lfs()'
175 $ hg files -r . 'set:copied() & lfs()'
176 l
176 l
177 $ hg status --change . 'set:removed()'
177 $ hg status --change . 'set:removed()'
178 R large
178 R large
179 R small
179 R small
180 $ hg status --change . 'set:removed() & lfs()'
180 $ hg status --change . 'set:removed() & lfs()'
181 R large
181 R large
182
182
183 $ echo SHORT > l
183 $ echo SHORT > l
184 $ echo BECOME-LARGER-FROM-SHORTER > s
184 $ echo BECOME-LARGER-FROM-SHORTER > s
185 $ hg commit -m 'large to small, small to large'
185 $ hg commit -m 'large to small, small to large'
186
186
187 $ echo 1 >> l
187 $ echo 1 >> l
188 $ echo 2 >> s
188 $ echo 2 >> s
189 $ hg commit -m 'random modifications'
189 $ hg commit -m 'random modifications'
190
190
191 $ echo RESTORE-TO-BE-LARGE > l
191 $ echo RESTORE-TO-BE-LARGE > l
192 $ echo SHORTER > s
192 $ echo SHORTER > s
193 $ hg commit -m 'switch large and small again'
193 $ hg commit -m 'switch large and small again'
194
194
195 # Test lfs_files template
195 # Test lfs_files template
196
196
197 $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n'
197 $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n'
198 0 large
198 0 large
199 1 l, large
199 1 l, large
200 2 s
200 2 s
201 3 s
201 3 s
202 4 l
202 4 l
203
203
204 # Push and pull the above repo
204 # Push and pull the above repo
205
205
206 $ hg --cwd .. init repo4
206 $ hg --cwd .. init repo4
207 $ hg push ../repo4
207 $ hg push ../repo4
208 pushing to ../repo4
208 pushing to ../repo4
209 searching for changes
209 searching for changes
210 adding changesets
210 adding changesets
211 adding manifests
211 adding manifests
212 adding file changes
212 adding file changes
213 added 5 changesets with 10 changes to 4 files
213 added 5 changesets with 10 changes to 4 files
214
214
215 $ hg --cwd .. init repo5
215 $ hg --cwd .. init repo5
216 $ hg --cwd ../repo5 pull ../repo3
216 $ hg --cwd ../repo5 pull ../repo3
217 pulling from ../repo3
217 pulling from ../repo3
218 requesting all changes
218 requesting all changes
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
222 added 5 changesets with 10 changes to 4 files
222 added 5 changesets with 10 changes to 4 files
223 new changesets fd47a419c4f7:5adf850972b9
223 new changesets fd47a419c4f7:5adf850972b9
224 (run 'hg update' to get a working copy)
224 (run 'hg update' to get a working copy)
225
225
226 $ cd ..
226 $ cd ..
227
227
228 # Test clone
228 # Test clone
229
229
230 $ hg init repo6
230 $ hg init repo6
231 $ cd repo6
231 $ cd repo6
232 $ cat >> .hg/hgrc << EOF
232 $ cat >> .hg/hgrc << EOF
233 > [lfs]
233 > [lfs]
234 > track=size(">30B")
234 > track=size(">30B")
235 > EOF
235 > EOF
236
236
237 $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large
237 $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large
238 $ echo SMALL > small
238 $ echo SMALL > small
239 $ hg commit -Aqm 'create a lfs file' large small
239 $ hg commit -Aqm 'create a lfs file' large small
240 $ hg debuglfsupload -r 'all()' -v
240 $ hg debuglfsupload -r 'all()' -v
241 lfs: found 8e92251415339ae9b148c8da89ed5ec665905166a1ab11b09dca8fad83344738 in the local lfs store
241 lfs: found 8e92251415339ae9b148c8da89ed5ec665905166a1ab11b09dca8fad83344738 in the local lfs store
242
242
243 $ cd ..
243 $ cd ..
244
244
245 $ hg clone repo6 repo7
245 $ hg clone repo6 repo7
246 updating to branch default
246 updating to branch default
247 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 $ cd repo7
248 $ cd repo7
249 $ hg config extensions --debug | grep lfs
249 $ hg config extensions --debug | grep lfs
250 $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
250 $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
251 $ cat large
251 $ cat large
252 LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
252 LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
253 $ cat small
253 $ cat small
254 SMALL
254 SMALL
255
255
256 $ cd ..
256 $ cd ..
257
257
258 $ hg --config extensions.share= share repo7 sharedrepo
258 $ hg --config extensions.share= share repo7 sharedrepo
259 updating working directory
259 updating working directory
260 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ hg -R sharedrepo config extensions --debug | grep lfs
261 $ hg -R sharedrepo config extensions --debug | grep lfs
262 $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
262 $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
263
263
264 # Test rename and status
264 # Test rename and status
265
265
266 $ hg init repo8
266 $ hg init repo8
267 $ cd repo8
267 $ cd repo8
268 $ cat >> .hg/hgrc << EOF
268 $ cat >> .hg/hgrc << EOF
269 > [lfs]
269 > [lfs]
270 > track=size(">10B")
270 > track=size(">10B")
271 > EOF
271 > EOF
272
272
273 $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1
273 $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1
274 $ echo SMALL > a2
274 $ echo SMALL > a2
275 $ hg commit -m a -A a1 a2
275 $ hg commit -m a -A a1 a2
276 $ hg status
276 $ hg status
277 $ hg mv a1 b1
277 $ hg mv a1 b1
278 $ hg mv a2 a1
278 $ hg mv a2 a1
279 $ hg mv b1 a2
279 $ hg mv b1 a2
280 $ hg commit -m b
280 $ hg commit -m b
281 $ hg status
281 $ hg status
282 >>> with open('a2', 'wb') as f:
282 >>> with open('a2', 'wb') as f:
283 ... f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA')
283 ... f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA')
284 >>> with open('a1', 'wb') as f:
284 >>> with open('a1', 'wb') as f:
285 ... f.write(b'\1\nMETA\n')
285 ... f.write(b'\1\nMETA\n')
286 $ hg commit -m meta
286 $ hg commit -m meta
287 $ hg status
287 $ hg status
288 $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'
288 $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'
289 2: | |
289 2: | |
290 1: a1 (a2)a2 (a1) | |
290 1: a1 (a2)a2 (a1) | |
291 0: | | a1 a2
291 0: | | a1 a2
292
292
293 $ for n in a1 a2; do
293 $ for n in a1 a2; do
294 > for r in 0 1 2; do
294 > for r in 0 1 2; do
295 > printf '\n%s @ %s\n' $n $r
295 > printf '\n%s @ %s\n' $n $r
296 > hg debugdata $n $r
296 > hg debugdata $n $r
297 > done
297 > done
298 > done
298 > done
299
299
300 a1 @ 0
300 a1 @ 0
301 version https://git-lfs.github.com/spec/v1
301 version https://git-lfs.github.com/spec/v1
302 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
302 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
303 size 29
303 size 29
304 x-is-binary 0
304 x-is-binary 0
305
305
306 a1 @ 1
306 a1 @ 1
307 \x01 (esc)
307 \x01 (esc)
308 copy: a2
308 copy: a2
309 copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9
309 copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9
310 \x01 (esc)
310 \x01 (esc)
311 SMALL
311 SMALL
312
312
313 a1 @ 2
313 a1 @ 2
314 \x01 (esc)
314 \x01 (esc)
315 \x01 (esc)
315 \x01 (esc)
316 \x01 (esc)
316 \x01 (esc)
317 META
317 META
318
318
319 a2 @ 0
319 a2 @ 0
320 SMALL
320 SMALL
321
321
322 a2 @ 1
322 a2 @ 1
323 version https://git-lfs.github.com/spec/v1
323 version https://git-lfs.github.com/spec/v1
324 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
324 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
325 size 29
325 size 29
326 x-hg-copy a1
326 x-hg-copy a1
327 x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4
327 x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4
328 x-is-binary 0
328 x-is-binary 0
329
329
330 a2 @ 2
330 a2 @ 2
331 version https://git-lfs.github.com/spec/v1
331 version https://git-lfs.github.com/spec/v1
332 oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
332 oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
333 size 32
333 size 32
334 x-is-binary 0
334 x-is-binary 0
335
335
336 # Verify commit hashes include rename metadata
336 # Verify commit hashes include rename metadata
337
337
338 $ hg log -T '{rev}:{node|short} {desc}\n'
338 $ hg log -T '{rev}:{node|short} {desc}\n'
339 2:0fae949de7fa meta
339 2:0fae949de7fa meta
340 1:9cd6bdffdac0 b
340 1:9cd6bdffdac0 b
341 0:7f96794915f7 a
341 0:7f96794915f7 a
342
342
343 $ cd ..
343 $ cd ..
344
344
345 # Test bundle
345 # Test bundle
346
346
347 $ hg init repo9
347 $ hg init repo9
348 $ cd repo9
348 $ cd repo9
349 $ cat >> .hg/hgrc << EOF
349 $ cat >> .hg/hgrc << EOF
350 > [lfs]
350 > [lfs]
351 > track=size(">10B")
351 > track=size(">10B")
352 > [diff]
352 > [diff]
353 > git=1
353 > git=1
354 > EOF
354 > EOF
355
355
356 $ for i in 0 single two three 4; do
356 $ for i in 0 single two three 4; do
357 > echo 'THIS-IS-LFS-'$i > a
357 > echo 'THIS-IS-LFS-'$i > a
358 > hg commit -m a-$i -A a
358 > hg commit -m a-$i -A a
359 > done
359 > done
360
360
361 $ hg update 2 -q
361 $ hg update 2 -q
362 $ echo 'THIS-IS-LFS-2-CHILD' > a
362 $ echo 'THIS-IS-LFS-2-CHILD' > a
363 $ hg commit -m branching -q
363 $ hg commit -m branching -q
364
364
365 $ hg bundle --base 1 bundle.hg -v
365 $ hg bundle --base 1 bundle.hg -v
366 lfs: found 5ab7a3739a5feec94a562d070a14f36dba7cad17e5484a4a89eea8e5f3166888 in the local lfs store
366 lfs: found 5ab7a3739a5feec94a562d070a14f36dba7cad17e5484a4a89eea8e5f3166888 in the local lfs store
367 lfs: found a9c7d1cd6ce2b9bbdf46ed9a862845228717b921c089d0d42e3bcaed29eb612e in the local lfs store
367 lfs: found a9c7d1cd6ce2b9bbdf46ed9a862845228717b921c089d0d42e3bcaed29eb612e in the local lfs store
368 lfs: found f693890c49c409ec33673b71e53f297681f76c1166daf33b2ad7ebf8b1d3237e in the local lfs store
368 lfs: found f693890c49c409ec33673b71e53f297681f76c1166daf33b2ad7ebf8b1d3237e in the local lfs store
369 lfs: found fda198fea753eb66a252e9856915e1f5cddbe41723bd4b695ece2604ad3c9f75 in the local lfs store
369 lfs: found fda198fea753eb66a252e9856915e1f5cddbe41723bd4b695ece2604ad3c9f75 in the local lfs store
370 4 changesets found
370 4 changesets found
371 uncompressed size of bundle content:
371 uncompressed size of bundle content:
372 * (changelog) (glob)
372 * (changelog) (glob)
373 * (manifests) (glob)
373 * (manifests) (glob)
374 * a (glob)
374 * a (glob)
375 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
375 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
376 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
376 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
377 5 branching
377 5 branching
378 diff --git a/a b/a
378 diff --git a/a b/a
379 --- a/a
379 --- a/a
380 +++ b/a
380 +++ b/a
381 @@ -1,1 +1,1 @@
381 @@ -1,1 +1,1 @@
382 -THIS-IS-LFS-two
382 -THIS-IS-LFS-two
383 +THIS-IS-LFS-2-CHILD
383 +THIS-IS-LFS-2-CHILD
384
384
385 4 a-4
385 4 a-4
386 diff --git a/a b/a
386 diff --git a/a b/a
387 --- a/a
387 --- a/a
388 +++ b/a
388 +++ b/a
389 @@ -1,1 +1,1 @@
389 @@ -1,1 +1,1 @@
390 -THIS-IS-LFS-three
390 -THIS-IS-LFS-three
391 +THIS-IS-LFS-4
391 +THIS-IS-LFS-4
392
392
393 3 a-three
393 3 a-three
394 diff --git a/a b/a
394 diff --git a/a b/a
395 --- a/a
395 --- a/a
396 +++ b/a
396 +++ b/a
397 @@ -1,1 +1,1 @@
397 @@ -1,1 +1,1 @@
398 -THIS-IS-LFS-two
398 -THIS-IS-LFS-two
399 +THIS-IS-LFS-three
399 +THIS-IS-LFS-three
400
400
401 2 a-two
401 2 a-two
402 diff --git a/a b/a
402 diff --git a/a b/a
403 --- a/a
403 --- a/a
404 +++ b/a
404 +++ b/a
405 @@ -1,1 +1,1 @@
405 @@ -1,1 +1,1 @@
406 -THIS-IS-LFS-single
406 -THIS-IS-LFS-single
407 +THIS-IS-LFS-two
407 +THIS-IS-LFS-two
408
408
409 1 a-single
409 1 a-single
410 diff --git a/a b/a
410 diff --git a/a b/a
411 --- a/a
411 --- a/a
412 +++ b/a
412 +++ b/a
413 @@ -1,1 +1,1 @@
413 @@ -1,1 +1,1 @@
414 -THIS-IS-LFS-0
414 -THIS-IS-LFS-0
415 +THIS-IS-LFS-single
415 +THIS-IS-LFS-single
416
416
417 0 a-0
417 0 a-0
418 diff --git a/a b/a
418 diff --git a/a b/a
419 new file mode 100644
419 new file mode 100644
420 --- /dev/null
420 --- /dev/null
421 +++ b/a
421 +++ b/a
422 @@ -0,0 +1,1 @@
422 @@ -0,0 +1,1 @@
423 +THIS-IS-LFS-0
423 +THIS-IS-LFS-0
424
424
425 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
425 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
426 $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a
426 $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a
427 5 branching
427 5 branching
428 diff --git a/a b/a
428 diff --git a/a b/a
429 --- a/a
429 --- a/a
430 +++ b/a
430 +++ b/a
431 @@ -1,1 +1,1 @@
431 @@ -1,1 +1,1 @@
432 -THIS-IS-LFS-two
432 -THIS-IS-LFS-two
433 +THIS-IS-LFS-2-CHILD
433 +THIS-IS-LFS-2-CHILD
434
434
435 4 a-4
435 4 a-4
436 diff --git a/a b/a
436 diff --git a/a b/a
437 --- a/a
437 --- a/a
438 +++ b/a
438 +++ b/a
439 @@ -1,1 +1,1 @@
439 @@ -1,1 +1,1 @@
440 -THIS-IS-LFS-three
440 -THIS-IS-LFS-three
441 +THIS-IS-LFS-4
441 +THIS-IS-LFS-4
442
442
443 3 a-three
443 3 a-three
444 diff --git a/a b/a
444 diff --git a/a b/a
445 --- a/a
445 --- a/a
446 +++ b/a
446 +++ b/a
447 @@ -1,1 +1,1 @@
447 @@ -1,1 +1,1 @@
448 -THIS-IS-LFS-two
448 -THIS-IS-LFS-two
449 +THIS-IS-LFS-three
449 +THIS-IS-LFS-three
450
450
451 2 a-two
451 2 a-two
452 diff --git a/a b/a
452 diff --git a/a b/a
453 --- a/a
453 --- a/a
454 +++ b/a
454 +++ b/a
455 @@ -1,1 +1,1 @@
455 @@ -1,1 +1,1 @@
456 -THIS-IS-LFS-single
456 -THIS-IS-LFS-single
457 +THIS-IS-LFS-two
457 +THIS-IS-LFS-two
458
458
459 1 a-single
459 1 a-single
460 diff --git a/a b/a
460 diff --git a/a b/a
461 --- a/a
461 --- a/a
462 +++ b/a
462 +++ b/a
463 @@ -1,1 +1,1 @@
463 @@ -1,1 +1,1 @@
464 -THIS-IS-LFS-0
464 -THIS-IS-LFS-0
465 +THIS-IS-LFS-single
465 +THIS-IS-LFS-single
466
466
467 0 a-0
467 0 a-0
468 diff --git a/a b/a
468 diff --git a/a b/a
469 new file mode 100644
469 new file mode 100644
470 --- /dev/null
470 --- /dev/null
471 +++ b/a
471 +++ b/a
472 @@ -0,0 +1,1 @@
472 @@ -0,0 +1,1 @@
473 +THIS-IS-LFS-0
473 +THIS-IS-LFS-0
474
474
475 $ cd ..
475 $ cd ..
476
476
477 # Test isbinary
477 # Test isbinary
478
478
479 $ hg init repo10
479 $ hg init repo10
480 $ cd repo10
480 $ cd repo10
481 $ cat >> .hg/hgrc << EOF
481 $ cat >> .hg/hgrc << EOF
482 > [extensions]
482 > [extensions]
483 > lfs=
483 > lfs=
484 > [lfs]
484 > [lfs]
485 > track=all()
485 > track=all()
486 > EOF
486 > EOF
487 $ $PYTHON <<'EOF'
487 $ $PYTHON <<'EOF'
488 > def write(path, content):
488 > def write(path, content):
489 > with open(path, 'wb') as f:
489 > with open(path, 'wb') as f:
490 > f.write(content)
490 > f.write(content)
491 > write('a', b'\0\0')
491 > write('a', b'\0\0')
492 > write('b', b'\1\n')
492 > write('b', b'\1\n')
493 > write('c', b'\1\n\0')
493 > write('c', b'\1\n\0')
494 > write('d', b'xx')
494 > write('d', b'xx')
495 > EOF
495 > EOF
496 $ hg add a b c d
496 $ hg add a b c d
497 $ hg diff --stat
497 $ hg diff --stat
498 a | Bin
498 a | Bin
499 b | 1 +
499 b | 1 +
500 c | Bin
500 c | Bin
501 d | 1 +
501 d | 1 +
502 4 files changed, 2 insertions(+), 0 deletions(-)
502 4 files changed, 2 insertions(+), 0 deletions(-)
503 $ hg commit -m binarytest
503 $ hg commit -m binarytest
504 $ cat > $TESTTMP/dumpbinary.py << EOF
504 $ cat > $TESTTMP/dumpbinary.py << EOF
505 > def reposetup(ui, repo):
505 > def reposetup(ui, repo):
506 > for n in 'abcd':
506 > for n in 'abcd':
507 > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
507 > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
508 > EOF
508 > EOF
509 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
509 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
510 a: binary=True
510 a: binary=True
511 b: binary=False
511 b: binary=False
512 c: binary=True
512 c: binary=True
513 d: binary=False
513 d: binary=False
514 b55353847f02 tip
514 b55353847f02 tip
515
515
516 $ cd ..
516 $ cd ..
517
517
518 # Test fctx.cmp fastpath - diff without LFS blobs
518 # Test fctx.cmp fastpath - diff without LFS blobs
519
519
520 $ hg init repo12
520 $ hg init repo12
521 $ cd repo12
521 $ cd repo12
522 $ cat >> .hg/hgrc <<EOF
522 $ cat >> .hg/hgrc <<EOF
523 > [lfs]
523 > [lfs]
524 > threshold=1
524 > threshold=1
525 > EOF
525 > EOF
526 $ cat > ../patch.diff <<EOF
526 $ cat > ../patch.diff <<EOF
527 > # HG changeset patch
527 > # HG changeset patch
528 > 2
528 > 2
529 >
529 >
530 > diff --git a/a b/a
530 > diff --git a/a b/a
531 > old mode 100644
531 > old mode 100644
532 > new mode 100755
532 > new mode 100755
533 > EOF
533 > EOF
534
534
535 $ for i in 1 2 3; do
535 $ for i in 1 2 3; do
536 > cp ../repo10/a a
536 > cp ../repo10/a a
537 > if [ $i = 3 ]; then
537 > if [ $i = 3 ]; then
538 > # make a content-only change
538 > # make a content-only change
539 > hg import -q --bypass ../patch.diff
539 > hg import -q --bypass ../patch.diff
540 > hg update -q
540 > hg update -q
541 > rm ../patch.diff
541 > rm ../patch.diff
542 > else
542 > else
543 > echo $i >> a
543 > echo $i >> a
544 > hg commit -m $i -A a
544 > hg commit -m $i -A a
545 > fi
545 > fi
546 > done
546 > done
547 $ [ -d .hg/store/lfs/objects ]
547 $ [ -d .hg/store/lfs/objects ]
548
548
549 $ cd ..
549 $ cd ..
550
550
551 $ hg clone repo12 repo13 --noupdate
551 $ hg clone repo12 repo13 --noupdate
552 $ cd repo13
552 $ cd repo13
553 $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git
553 $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git
554 2
554 2
555 diff --git a/a b/a
555 diff --git a/a b/a
556 old mode 100644
556 old mode 100644
557 new mode 100755
557 new mode 100755
558
558
559 2
559 2
560 diff --git a/a b/a
560 diff --git a/a b/a
561 Binary file a has changed
561 Binary file a has changed
562
562
563 1
563 1
564 diff --git a/a b/a
564 diff --git a/a b/a
565 new file mode 100644
565 new file mode 100644
566 Binary file a has changed
566 Binary file a has changed
567
567
568 $ [ -d .hg/store/lfs/objects ]
568 $ [ -d .hg/store/lfs/objects ]
569 [1]
569 [1]
570
570
571 $ cd ..
571 $ cd ..
572
572
573 # Test filter
573 # Test filter
574
574
575 $ hg init repo11
575 $ hg init repo11
576 $ cd repo11
576 $ cd repo11
577 $ cat >> .hg/hgrc << EOF
577 $ cat >> .hg/hgrc << EOF
578 > [lfs]
578 > [lfs]
579 > track=(**.a & size(">5B")) | (**.b & !size(">5B"))
579 > track=(**.a & size(">5B")) | (**.b & !size(">5B"))
580 > | (**.c & "path:d" & !"path:d/c.c") | size(">10B")
580 > | (**.c & "path:d" & !"path:d/c.c") | size(">10B")
581 > EOF
581 > EOF
582
582
583 $ mkdir a
583 $ mkdir a
584 $ echo aaaaaa > a/1.a
584 $ echo aaaaaa > a/1.a
585 $ echo a > a/2.a
585 $ echo a > a/2.a
586 $ echo aaaaaa > 1.b
586 $ echo aaaaaa > 1.b
587 $ echo a > 2.b
587 $ echo a > 2.b
588 $ echo a > 1.c
588 $ echo a > 1.c
589 $ mkdir d
589 $ mkdir d
590 $ echo a > d/c.c
590 $ echo a > d/c.c
591 $ echo a > d/d.c
591 $ echo a > d/d.c
592 $ echo aaaaaaaaaaaa > x
592 $ echo aaaaaaaaaaaa > x
593 $ hg add . -q
593 $ hg add . -q
594 $ hg commit -m files
594 $ hg commit -m files
595
595
596 $ for p in a/1.a a/2.a 1.b 2.b 1.c d/c.c d/d.c x; do
596 $ for p in a/1.a a/2.a 1.b 2.b 1.c d/c.c d/d.c x; do
597 > if hg debugdata $p 0 2>&1 | grep git-lfs >/dev/null; then
597 > if hg debugdata $p 0 2>&1 | grep git-lfs >/dev/null; then
598 > echo "${p}: is lfs"
598 > echo "${p}: is lfs"
599 > else
599 > else
600 > echo "${p}: not lfs"
600 > echo "${p}: not lfs"
601 > fi
601 > fi
602 > done
602 > done
603 a/1.a: is lfs
603 a/1.a: is lfs
604 a/2.a: not lfs
604 a/2.a: not lfs
605 1.b: not lfs
605 1.b: not lfs
606 2.b: is lfs
606 2.b: is lfs
607 1.c: not lfs
607 1.c: not lfs
608 d/c.c: not lfs
608 d/c.c: not lfs
609 d/d.c: is lfs
609 d/d.c: is lfs
610 x: is lfs
610 x: is lfs
611
611
612 $ cd ..
612 $ cd ..
613
613
614 # Verify the repos
614 # Verify the repos
615
615
616 $ cat > $TESTTMP/dumpflog.py << EOF
616 $ cat > $TESTTMP/dumpflog.py << EOF
617 > # print raw revision sizes, flags, and hashes for certain files
617 > # print raw revision sizes, flags, and hashes for certain files
618 > import hashlib
618 > import hashlib
619 > from mercurial.node import short
619 > from mercurial import revlog
620 > from mercurial import revlog
620 > from mercurial.node import short
621 > def hash(rawtext):
621 > def hash(rawtext):
622 > h = hashlib.sha512()
622 > h = hashlib.sha512()
623 > h.update(rawtext)
623 > h.update(rawtext)
624 > return h.hexdigest()[:4]
624 > return h.hexdigest()[:4]
625 > def reposetup(ui, repo):
625 > def reposetup(ui, repo):
626 > # these 2 files are interesting
626 > # these 2 files are interesting
627 > for name in ['l', 's']:
627 > for name in ['l', 's']:
628 > fl = repo.file(name)
628 > fl = repo.file(name)
629 > if len(fl) == 0:
629 > if len(fl) == 0:
630 > continue
630 > continue
631 > sizes = [revlog.revlog.rawsize(fl, i) for i in fl]
631 > sizes = [revlog.revlog.rawsize(fl, i) for i in fl]
632 > texts = [fl.revision(i, raw=True) for i in fl]
632 > texts = [fl.revision(i, raw=True) for i in fl]
633 > flags = [int(fl.flags(i)) for i in fl]
633 > flags = [int(fl.flags(i)) for i in fl]
634 > hashes = [hash(t) for t in texts]
634 > hashes = [hash(t) for t in texts]
635 > print(' %s: rawsizes=%r flags=%r hashes=%r'
635 > print(' %s: rawsizes=%r flags=%r hashes=%r'
636 > % (name, sizes, flags, hashes))
636 > % (name, sizes, flags, hashes))
637 > EOF
637 > EOF
638
638
639 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \
639 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \
640 > repo10; do
640 > repo10; do
641 > echo 'repo:' $i
641 > echo 'repo:' $i
642 > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q
642 > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q
643 > done
643 > done
644 repo: client
644 repo: client
645 repo: client2
645 repo: client2
646 repo: server
646 repo: server
647 repo: repo3
647 repo: repo3
648 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
648 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
649 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
649 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
650 repo: repo4
650 repo: repo4
651 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
651 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
652 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
652 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
653 repo: repo5
653 repo: repo5
654 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
654 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
655 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
655 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
656 repo: repo6
656 repo: repo6
657 repo: repo7
657 repo: repo7
658 repo: repo8
658 repo: repo8
659 repo: repo9
659 repo: repo9
660 repo: repo10
660 repo: repo10
661
661
662 repo13 doesn't have any cached lfs files and its source never pushed its
662 repo13 doesn't have any cached lfs files and its source never pushed its
663 files. Therefore, the files don't exist in the remote store. Use the files in
663 files. Therefore, the files don't exist in the remote store. Use the files in
664 the user cache.
664 the user cache.
665
665
666 $ test -d $TESTTMP/repo13/.hg/store/lfs/objects
666 $ test -d $TESTTMP/repo13/.hg/store/lfs/objects
667 [1]
667 [1]
668
668
669 $ hg --config extensions.share= share repo13 repo14
669 $ hg --config extensions.share= share repo13 repo14
670 updating working directory
670 updating working directory
671 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
671 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
672 $ hg -R repo14 -q verify
672 $ hg -R repo14 -q verify
673
673
674 $ hg clone repo13 repo15
674 $ hg clone repo13 repo15
675 updating to branch default
675 updating to branch default
676 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
676 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
677 $ hg -R repo15 -q verify
677 $ hg -R repo15 -q verify
678
678
679 If the source repo doesn't have the blob (maybe it was pulled or cloned with
679 If the source repo doesn't have the blob (maybe it was pulled or cloned with
680 --noupdate), the blob is still accessible via the global cache to send to the
680 --noupdate), the blob is still accessible via the global cache to send to the
681 remote store.
681 remote store.
682
682
683 $ rm -rf $TESTTMP/repo15/.hg/store/lfs
683 $ rm -rf $TESTTMP/repo15/.hg/store/lfs
684 $ hg init repo16
684 $ hg init repo16
685 $ hg -R repo15 push repo16
685 $ hg -R repo15 push repo16
686 pushing to repo16
686 pushing to repo16
687 searching for changes
687 searching for changes
688 adding changesets
688 adding changesets
689 adding manifests
689 adding manifests
690 adding file changes
690 adding file changes
691 added 3 changesets with 2 changes to 1 files
691 added 3 changesets with 2 changes to 1 files
692 $ hg -R repo15 -q verify
692 $ hg -R repo15 -q verify
693
693
694 Test damaged file scenarios. (This also damages the usercache because of the
694 Test damaged file scenarios. (This also damages the usercache because of the
695 hardlinks.)
695 hardlinks.)
696
696
697 $ echo 'damage' >> repo5/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
697 $ echo 'damage' >> repo5/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
698
698
699 Repo with damaged lfs objects in any revision will fail verification.
699 Repo with damaged lfs objects in any revision will fail verification.
700
700
701 $ hg -R repo5 verify
701 $ hg -R repo5 verify
702 checking changesets
702 checking changesets
703 checking manifests
703 checking manifests
704 crosschecking files in changesets and manifests
704 crosschecking files in changesets and manifests
705 checking files
705 checking files
706 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
706 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
707 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
707 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
708 4 files, 5 changesets, 10 total revisions
708 4 files, 5 changesets, 10 total revisions
709 2 integrity errors encountered!
709 2 integrity errors encountered!
710 (first damaged changeset appears to be 0)
710 (first damaged changeset appears to be 0)
711 [1]
711 [1]
712
712
713 Updates work after cloning a damaged repo, if the damaged lfs objects aren't in
713 Updates work after cloning a damaged repo, if the damaged lfs objects aren't in
714 the update destination. Those objects won't be added to the new repo's store
714 the update destination. Those objects won't be added to the new repo's store
715 because they aren't accessed.
715 because they aren't accessed.
716
716
717 $ hg clone -v repo5 fromcorrupt
717 $ hg clone -v repo5 fromcorrupt
718 updating to branch default
718 updating to branch default
719 resolving manifests
719 resolving manifests
720 getting l
720 getting l
721 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the usercache
721 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the usercache
722 getting s
722 getting s
723 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
723 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
724 $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
724 $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
725 [1]
725 [1]
726
726
727 Verify will copy/link all lfs objects into the local store that aren't already
727 Verify will copy/link all lfs objects into the local store that aren't already
728 present. Bypass the corrupted usercache to show that verify works when fed by
728 present. Bypass the corrupted usercache to show that verify works when fed by
729 the (uncorrupted) remote store.
729 the (uncorrupted) remote store.
730
730
731 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
731 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
732 repository uses revlog format 1
732 repository uses revlog format 1
733 checking changesets
733 checking changesets
734 checking manifests
734 checking manifests
735 crosschecking files in changesets and manifests
735 crosschecking files in changesets and manifests
736 checking files
736 checking files
737 lfs: adding 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e to the usercache
737 lfs: adding 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e to the usercache
738 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
738 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
739 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
739 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
740 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
740 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
741 lfs: adding 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 to the usercache
741 lfs: adding 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 to the usercache
742 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
742 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
743 lfs: adding b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c to the usercache
743 lfs: adding b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c to the usercache
744 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
744 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
745 4 files, 5 changesets, 10 total revisions
745 4 files, 5 changesets, 10 total revisions
746
746
747 Verify will not copy/link a corrupted file from the usercache into the local
747 Verify will not copy/link a corrupted file from the usercache into the local
748 store, and poison it. (The verify with a good remote now works.)
748 store, and poison it. (The verify with a good remote now works.)
749
749
750 $ rm -r fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
750 $ rm -r fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
751 $ hg -R fromcorrupt verify -v
751 $ hg -R fromcorrupt verify -v
752 repository uses revlog format 1
752 repository uses revlog format 1
753 checking changesets
753 checking changesets
754 checking manifests
754 checking manifests
755 crosschecking files in changesets and manifests
755 crosschecking files in changesets and manifests
756 checking files
756 checking files
757 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
757 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
758 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
758 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
759 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
759 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
760 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
760 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
761 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
761 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
762 4 files, 5 changesets, 10 total revisions
762 4 files, 5 changesets, 10 total revisions
763 2 integrity errors encountered!
763 2 integrity errors encountered!
764 (first damaged changeset appears to be 0)
764 (first damaged changeset appears to be 0)
765 [1]
765 [1]
766 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
766 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
767 repository uses revlog format 1
767 repository uses revlog format 1
768 checking changesets
768 checking changesets
769 checking manifests
769 checking manifests
770 crosschecking files in changesets and manifests
770 crosschecking files in changesets and manifests
771 checking files
771 checking files
772 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the usercache
772 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the usercache
773 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
773 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
774 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
774 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
775 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
775 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
776 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
776 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
777 4 files, 5 changesets, 10 total revisions
777 4 files, 5 changesets, 10 total revisions
778
778
779 Damaging a file required by the update destination fails the update.
779 Damaging a file required by the update destination fails the update.
780
780
781 $ echo 'damage' >> $TESTTMP/dummy-remote/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
781 $ echo 'damage' >> $TESTTMP/dummy-remote/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
782 $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2
782 $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2
783 updating to branch default
783 updating to branch default
784 resolving manifests
784 resolving manifests
785 abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
785 abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
786 [255]
786 [255]
787
787
788 A corrupted lfs blob is not transferred from a file://remotestore to the
788 A corrupted lfs blob is not transferred from a file://remotestore to the
789 usercache or local store.
789 usercache or local store.
790
790
791 $ test -f emptycache/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
791 $ test -f emptycache/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
792 [1]
792 [1]
793 $ test -f fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
793 $ test -f fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
794 [1]
794 [1]
795
795
796 $ hg -R fromcorrupt2 verify
796 $ hg -R fromcorrupt2 verify
797 checking changesets
797 checking changesets
798 checking manifests
798 checking manifests
799 crosschecking files in changesets and manifests
799 crosschecking files in changesets and manifests
800 checking files
800 checking files
801 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
801 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
802 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
802 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
803 4 files, 5 changesets, 10 total revisions
803 4 files, 5 changesets, 10 total revisions
804 2 integrity errors encountered!
804 2 integrity errors encountered!
805 (first damaged changeset appears to be 0)
805 (first damaged changeset appears to be 0)
806 [1]
806 [1]
807
807
808 Corrupt local files are not sent upstream. (The alternate dummy remote
808 Corrupt local files are not sent upstream. (The alternate dummy remote
809 avoids the corrupt lfs object in the original remote.)
809 avoids the corrupt lfs object in the original remote.)
810
810
811 $ mkdir $TESTTMP/dummy-remote2
811 $ mkdir $TESTTMP/dummy-remote2
812 $ hg init dest
812 $ hg init dest
813 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 push -v dest
813 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 push -v dest
814 pushing to dest
814 pushing to dest
815 searching for changes
815 searching for changes
816 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
816 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
817 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
817 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
818 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
818 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
819 abort: detected corrupt lfs object: 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
819 abort: detected corrupt lfs object: 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
820 (run hg verify)
820 (run hg verify)
821 [255]
821 [255]
822
822
823 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 verify -v
823 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 verify -v
824 repository uses revlog format 1
824 repository uses revlog format 1
825 checking changesets
825 checking changesets
826 checking manifests
826 checking manifests
827 crosschecking files in changesets and manifests
827 crosschecking files in changesets and manifests
828 checking files
828 checking files
829 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
829 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
830 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
830 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
831 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
831 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
832 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
832 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
833 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
833 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
834 4 files, 5 changesets, 10 total revisions
834 4 files, 5 changesets, 10 total revisions
835 2 integrity errors encountered!
835 2 integrity errors encountered!
836 (first damaged changeset appears to be 0)
836 (first damaged changeset appears to be 0)
837 [1]
837 [1]
838
838
839 $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
839 $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
840 sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
840 sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
841 $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
841 $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
842 sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
842 sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
843 $ test -f $TESTTMP/dummy-remote2/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
843 $ test -f $TESTTMP/dummy-remote2/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
844 [1]
844 [1]
845
845
846 Accessing a corrupt file will complain
846 Accessing a corrupt file will complain
847
847
848 $ hg --cwd fromcorrupt2 cat -r 0 large
848 $ hg --cwd fromcorrupt2 cat -r 0 large
849 abort: integrity check failed on data/large.i:0!
849 abort: integrity check failed on data/large.i:0!
850 [255]
850 [255]
851
851
852 lfs -> normal -> lfs round trip conversions are possible. The 'none()'
852 lfs -> normal -> lfs round trip conversions are possible. The 'none()'
853 predicate on the command line will override whatever is configured globally and
853 predicate on the command line will override whatever is configured globally and
854 locally, and ensures everything converts to a regular file. For lfs -> normal,
854 locally, and ensures everything converts to a regular file. For lfs -> normal,
855 there's no 'lfs' destination repo requirement. For normal -> lfs, there is.
855 there's no 'lfs' destination repo requirement. For normal -> lfs, there is.
856
856
857 $ hg --config extensions.convert= --config 'lfs.track=none()' \
857 $ hg --config extensions.convert= --config 'lfs.track=none()' \
858 > convert repo8 convert_normal
858 > convert repo8 convert_normal
859 initializing destination convert_normal repository
859 initializing destination convert_normal repository
860 scanning source...
860 scanning source...
861 sorting...
861 sorting...
862 converting...
862 converting...
863 2 a
863 2 a
864 1 b
864 1 b
865 0 meta
865 0 meta
866 $ grep 'lfs' convert_normal/.hg/requires
866 $ grep 'lfs' convert_normal/.hg/requires
867 [1]
867 [1]
868 $ hg --cwd convert_normal cat a1 -r 0 -T '{rawdata}'
868 $ hg --cwd convert_normal cat a1 -r 0 -T '{rawdata}'
869 THIS-IS-LFS-BECAUSE-10-BYTES
869 THIS-IS-LFS-BECAUSE-10-BYTES
870
870
871 $ hg --config extensions.convert= --config lfs.threshold=10B \
871 $ hg --config extensions.convert= --config lfs.threshold=10B \
872 > convert convert_normal convert_lfs
872 > convert convert_normal convert_lfs
873 initializing destination convert_lfs repository
873 initializing destination convert_lfs repository
874 scanning source...
874 scanning source...
875 sorting...
875 sorting...
876 converting...
876 converting...
877 2 a
877 2 a
878 1 b
878 1 b
879 0 meta
879 0 meta
880
880
881 $ hg --cwd convert_lfs cat -r 0 a1 -T '{rawdata}'
881 $ hg --cwd convert_lfs cat -r 0 a1 -T '{rawdata}'
882 version https://git-lfs.github.com/spec/v1
882 version https://git-lfs.github.com/spec/v1
883 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
883 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
884 size 29
884 size 29
885 x-is-binary 0
885 x-is-binary 0
886 $ hg --cwd convert_lfs debugdata a1 0
886 $ hg --cwd convert_lfs debugdata a1 0
887 version https://git-lfs.github.com/spec/v1
887 version https://git-lfs.github.com/spec/v1
888 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
888 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
889 size 29
889 size 29
890 x-is-binary 0
890 x-is-binary 0
891 $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfspointer % '{key}={value}\n'}'}"
891 $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfspointer % '{key}={value}\n'}'}"
892 version=https://git-lfs.github.com/spec/v1
892 version=https://git-lfs.github.com/spec/v1
893 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
893 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
894 size=29
894 size=29
895 x-is-binary=0
895 x-is-binary=0
896 $ hg --cwd convert_lfs log -r 0 \
896 $ hg --cwd convert_lfs log -r 0 \
897 > -T '{lfs_files % "{get(lfspointer, "oid")}\n"}{lfs_files % "{lfspointer.oid}\n"}'
897 > -T '{lfs_files % "{get(lfspointer, "oid")}\n"}{lfs_files % "{lfspointer.oid}\n"}'
898 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
898 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
899 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
899 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
900 $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfspointer}\n"}'
900 $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfspointer}\n"}'
901 version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0
901 version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0
902 $ hg --cwd convert_lfs \
902 $ hg --cwd convert_lfs \
903 > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}'
903 > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}'
904 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
904 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
905 1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
905 1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
906 2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
906 2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
907
907
908 $ grep 'lfs' convert_lfs/.hg/requires
908 $ grep 'lfs' convert_lfs/.hg/requires
909 lfs
909 lfs
910
910
911 The hashes in all stages of the conversion are unchanged.
911 The hashes in all stages of the conversion are unchanged.
912
912
913 $ hg -R repo8 log -T '{node|short}\n'
913 $ hg -R repo8 log -T '{node|short}\n'
914 0fae949de7fa
914 0fae949de7fa
915 9cd6bdffdac0
915 9cd6bdffdac0
916 7f96794915f7
916 7f96794915f7
917 $ hg -R convert_normal log -T '{node|short}\n'
917 $ hg -R convert_normal log -T '{node|short}\n'
918 0fae949de7fa
918 0fae949de7fa
919 9cd6bdffdac0
919 9cd6bdffdac0
920 7f96794915f7
920 7f96794915f7
921 $ hg -R convert_lfs log -T '{node|short}\n'
921 $ hg -R convert_lfs log -T '{node|short}\n'
922 0fae949de7fa
922 0fae949de7fa
923 9cd6bdffdac0
923 9cd6bdffdac0
924 7f96794915f7
924 7f96794915f7
925
925
926 This convert is trickier, because it contains deleted files (via `hg mv`)
926 This convert is trickier, because it contains deleted files (via `hg mv`)
927
927
928 $ hg --config extensions.convert= --config lfs.threshold=1000M \
928 $ hg --config extensions.convert= --config lfs.threshold=1000M \
929 > convert repo3 convert_normal2
929 > convert repo3 convert_normal2
930 initializing destination convert_normal2 repository
930 initializing destination convert_normal2 repository
931 scanning source...
931 scanning source...
932 sorting...
932 sorting...
933 converting...
933 converting...
934 4 commit with lfs content
934 4 commit with lfs content
935 3 renames
935 3 renames
936 2 large to small, small to large
936 2 large to small, small to large
937 1 random modifications
937 1 random modifications
938 0 switch large and small again
938 0 switch large and small again
939 $ grep 'lfs' convert_normal2/.hg/requires
939 $ grep 'lfs' convert_normal2/.hg/requires
940 [1]
940 [1]
941 $ hg --cwd convert_normal2 debugdata large 0
941 $ hg --cwd convert_normal2 debugdata large 0
942 LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
942 LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
943
943
944 $ hg --config extensions.convert= --config lfs.threshold=10B \
944 $ hg --config extensions.convert= --config lfs.threshold=10B \
945 > convert convert_normal2 convert_lfs2
945 > convert convert_normal2 convert_lfs2
946 initializing destination convert_lfs2 repository
946 initializing destination convert_lfs2 repository
947 scanning source...
947 scanning source...
948 sorting...
948 sorting...
949 converting...
949 converting...
950 4 commit with lfs content
950 4 commit with lfs content
951 3 renames
951 3 renames
952 2 large to small, small to large
952 2 large to small, small to large
953 1 random modifications
953 1 random modifications
954 0 switch large and small again
954 0 switch large and small again
955 $ grep 'lfs' convert_lfs2/.hg/requires
955 $ grep 'lfs' convert_lfs2/.hg/requires
956 lfs
956 lfs
957 $ hg --cwd convert_lfs2 debugdata large 0
957 $ hg --cwd convert_lfs2 debugdata large 0
958 version https://git-lfs.github.com/spec/v1
958 version https://git-lfs.github.com/spec/v1
959 oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
959 oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
960 size 39
960 size 39
961 x-is-binary 0
961 x-is-binary 0
962
962
963 $ hg -R convert_lfs2 config --debug extensions | grep lfs
963 $ hg -R convert_lfs2 config --debug extensions | grep lfs
964 $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob)
964 $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob)
965
965
966 Committing deleted files works:
966 Committing deleted files works:
967
967
968 $ hg init $TESTTMP/repo-del
968 $ hg init $TESTTMP/repo-del
969 $ cd $TESTTMP/repo-del
969 $ cd $TESTTMP/repo-del
970 $ echo 1 > A
970 $ echo 1 > A
971 $ hg commit -m 'add A' -A A
971 $ hg commit -m 'add A' -A A
972 $ hg rm A
972 $ hg rm A
973 $ hg commit -m 'rm A'
973 $ hg commit -m 'rm A'
974
974
975 Bad .hglfs files will block the commit with a useful message
975 Bad .hglfs files will block the commit with a useful message
976
976
977 $ cat > .hglfs << EOF
977 $ cat > .hglfs << EOF
978 > [track]
978 > [track]
979 > **.test = size(">5B")
979 > **.test = size(">5B")
980 > bad file ... no commit
980 > bad file ... no commit
981 > EOF
981 > EOF
982
982
983 $ echo x > file.txt
983 $ echo x > file.txt
984 $ hg ci -Aqm 'should fail'
984 $ hg ci -Aqm 'should fail'
985 hg: parse error at .hglfs:3: bad file ... no commit
985 hg: parse error at .hglfs:3: bad file ... no commit
986 [255]
986 [255]
987
987
988 $ cat > .hglfs << EOF
988 $ cat > .hglfs << EOF
989 > [track]
989 > [track]
990 > **.test = size(">5B")
990 > **.test = size(">5B")
991 > ** = nonexistent()
991 > ** = nonexistent()
992 > EOF
992 > EOF
993
993
994 $ hg ci -Aqm 'should fail'
994 $ hg ci -Aqm 'should fail'
995 abort: parse error in .hglfs: unknown identifier: nonexistent
995 abort: parse error in .hglfs: unknown identifier: nonexistent
996 [255]
996 [255]
997
997
998 '**' works out to mean all files.
998 '**' works out to mean all files.
999
999
1000 $ cat > .hglfs << EOF
1000 $ cat > .hglfs << EOF
1001 > [track]
1001 > [track]
1002 > path:.hglfs = none()
1002 > path:.hglfs = none()
1003 > **.test = size(">5B")
1003 > **.test = size(">5B")
1004 > **.exclude = none()
1004 > **.exclude = none()
1005 > ** = size(">10B")
1005 > ** = size(">10B")
1006 > EOF
1006 > EOF
1007
1007
1008 The LFS policy takes effect without tracking the .hglfs file
1008 The LFS policy takes effect without tracking the .hglfs file
1009
1009
1010 $ echo 'largefile' > lfs.test
1010 $ echo 'largefile' > lfs.test
1011 $ echo '012345678901234567890' > nolfs.exclude
1011 $ echo '012345678901234567890' > nolfs.exclude
1012 $ echo '01234567890123456' > lfs.catchall
1012 $ echo '01234567890123456' > lfs.catchall
1013 $ hg add *
1013 $ hg add *
1014 $ hg ci -qm 'before add .hglfs'
1014 $ hg ci -qm 'before add .hglfs'
1015 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1015 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1016 2: lfs.catchall: d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9
1016 2: lfs.catchall: d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9
1017 lfs.test: 5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c
1017 lfs.test: 5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c
1018
1018
1019 The .hglfs file works when tracked
1019 The .hglfs file works when tracked
1020
1020
1021 $ echo 'largefile2' > lfs.test
1021 $ echo 'largefile2' > lfs.test
1022 $ echo '012345678901234567890a' > nolfs.exclude
1022 $ echo '012345678901234567890a' > nolfs.exclude
1023 $ echo '01234567890123456a' > lfs.catchall
1023 $ echo '01234567890123456a' > lfs.catchall
1024 $ hg ci -Aqm 'after adding .hglfs'
1024 $ hg ci -Aqm 'after adding .hglfs'
1025 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1025 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1026 3: lfs.catchall: 31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573
1026 3: lfs.catchall: 31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573
1027 lfs.test: 8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6
1027 lfs.test: 8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6
1028
1028
1029 The LFS policy stops when the .hglfs is gone
1029 The LFS policy stops when the .hglfs is gone
1030
1030
1031 $ mv .hglfs .hglfs_
1031 $ mv .hglfs .hglfs_
1032 $ echo 'largefile3' > lfs.test
1032 $ echo 'largefile3' > lfs.test
1033 $ echo '012345678901234567890abc' > nolfs.exclude
1033 $ echo '012345678901234567890abc' > nolfs.exclude
1034 $ echo '01234567890123456abc' > lfs.catchall
1034 $ echo '01234567890123456abc' > lfs.catchall
1035 $ hg ci -qm 'file test' -X .hglfs
1035 $ hg ci -qm 'file test' -X .hglfs
1036 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1036 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1037 4:
1037 4:
1038
1038
1039 $ mv .hglfs_ .hglfs
1039 $ mv .hglfs_ .hglfs
1040 $ echo '012345678901234567890abc' > lfs.test
1040 $ echo '012345678901234567890abc' > lfs.test
1041 $ hg ci -m 'back to lfs'
1041 $ hg ci -m 'back to lfs'
1042 $ hg rm lfs.test
1042 $ hg rm lfs.test
1043 $ hg ci -qm 'remove lfs'
1043 $ hg ci -qm 'remove lfs'
1044
1044
1045 {lfs_files} will list deleted files too
1045 {lfs_files} will list deleted files too
1046
1046
1047 $ hg log -T "{lfs_files % '{rev} {file}: {lfspointer.oid}\n'}"
1047 $ hg log -T "{lfs_files % '{rev} {file}: {lfspointer.oid}\n'}"
1048 6 lfs.test:
1048 6 lfs.test:
1049 5 lfs.test: sha256:43f8f41171b6f62a6b61ba4ce98a8a6c1649240a47ebafd43120aa215ac9e7f6
1049 5 lfs.test: sha256:43f8f41171b6f62a6b61ba4ce98a8a6c1649240a47ebafd43120aa215ac9e7f6
1050 3 lfs.catchall: sha256:31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573
1050 3 lfs.catchall: sha256:31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573
1051 3 lfs.test: sha256:8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6
1051 3 lfs.test: sha256:8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6
1052 2 lfs.catchall: sha256:d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9
1052 2 lfs.catchall: sha256:d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9
1053 2 lfs.test: sha256:5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c
1053 2 lfs.test: sha256:5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c
1054
1054
1055 $ hg log -r 'file("set:lfs()")' -T '{rev} {join(lfs_files, ", ")}\n'
1055 $ hg log -r 'file("set:lfs()")' -T '{rev} {join(lfs_files, ", ")}\n'
1056 2 lfs.catchall, lfs.test
1056 2 lfs.catchall, lfs.test
1057 3 lfs.catchall, lfs.test
1057 3 lfs.catchall, lfs.test
1058 5 lfs.test
1058 5 lfs.test
1059 6 lfs.test
1059 6 lfs.test
1060
1060
1061 $ cd ..
1061 $ cd ..
1062
1062
1063 Unbundling adds a requirement to a non-lfs repo, if necessary.
1063 Unbundling adds a requirement to a non-lfs repo, if necessary.
1064
1064
1065 $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg
1065 $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg
1066 $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg
1066 $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg
1067 $ hg init unbundle
1067 $ hg init unbundle
1068 $ hg pull -R unbundle -q nolfs.hg
1068 $ hg pull -R unbundle -q nolfs.hg
1069 $ grep lfs unbundle/.hg/requires
1069 $ grep lfs unbundle/.hg/requires
1070 [1]
1070 [1]
1071 $ hg pull -R unbundle -q lfs.hg
1071 $ hg pull -R unbundle -q lfs.hg
1072 $ grep lfs unbundle/.hg/requires
1072 $ grep lfs unbundle/.hg/requires
1073 lfs
1073 lfs
1074
1074
1075 $ hg init no_lfs
1075 $ hg init no_lfs
1076 $ cat >> no_lfs/.hg/hgrc <<EOF
1076 $ cat >> no_lfs/.hg/hgrc <<EOF
1077 > [experimental]
1077 > [experimental]
1078 > changegroup3 = True
1078 > changegroup3 = True
1079 > [extensions]
1079 > [extensions]
1080 > lfs=!
1080 > lfs=!
1081 > EOF
1081 > EOF
1082 $ cp -R no_lfs no_lfs2
1082 $ cp -R no_lfs no_lfs2
1083
1083
1084 Pushing from a local lfs repo to a local repo without an lfs requirement and
1084 Pushing from a local lfs repo to a local repo without an lfs requirement and
1085 with lfs disabled, fails.
1085 with lfs disabled, fails.
1086
1086
1087 $ hg push -R convert_lfs2 no_lfs
1087 $ hg push -R convert_lfs2 no_lfs
1088 pushing to no_lfs
1088 pushing to no_lfs
1089 abort: required features are not supported in the destination: lfs
1089 abort: required features are not supported in the destination: lfs
1090 [255]
1090 [255]
1091 $ grep lfs no_lfs/.hg/requires
1091 $ grep lfs no_lfs/.hg/requires
1092 [1]
1092 [1]
1093
1093
1094 Pulling from a local lfs repo to a local repo without an lfs requirement and
1094 Pulling from a local lfs repo to a local repo without an lfs requirement and
1095 with lfs disabled, fails.
1095 with lfs disabled, fails.
1096
1096
1097 $ hg pull -R no_lfs2 convert_lfs2
1097 $ hg pull -R no_lfs2 convert_lfs2
1098 pulling from convert_lfs2
1098 pulling from convert_lfs2
1099 abort: required features are not supported in the destination: lfs
1099 abort: required features are not supported in the destination: lfs
1100 [255]
1100 [255]
1101 $ grep lfs no_lfs2/.hg/requires
1101 $ grep lfs no_lfs2/.hg/requires
1102 [1]
1102 [1]
@@ -1,367 +1,372 b''
1 test that a commit clears the merge state.
1 test that a commit clears the merge state.
2
2
3 $ hg init repo
3 $ hg init repo
4 $ cd repo
4 $ cd repo
5
5
6 $ echo foo > file1
6 $ echo foo > file1
7 $ echo foo > file2
7 $ echo foo > file2
8 $ hg commit -Am 'add files'
8 $ hg commit -Am 'add files'
9 adding file1
9 adding file1
10 adding file2
10 adding file2
11
11
12 $ echo bar >> file1
12 $ echo bar >> file1
13 $ echo bar >> file2
13 $ echo bar >> file2
14 $ hg commit -Am 'append bar to files'
14 $ hg commit -Am 'append bar to files'
15
15
16 create a second head with conflicting edits
16 create a second head with conflicting edits
17
17
18 $ hg up -C 0
18 $ hg up -C 0
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ echo baz >> file1
20 $ echo baz >> file1
21 $ echo baz >> file2
21 $ echo baz >> file2
22 $ hg commit -Am 'append baz to files'
22 $ hg commit -Am 'append baz to files'
23 created new head
23 created new head
24
24
25 create a third head with no conflicting edits
25 create a third head with no conflicting edits
26 $ hg up -qC 0
26 $ hg up -qC 0
27 $ echo foo > file3
27 $ echo foo > file3
28 $ hg commit -Am 'add non-conflicting file'
28 $ hg commit -Am 'add non-conflicting file'
29 adding file3
29 adding file3
30 created new head
30 created new head
31
31
32 failing merge
32 failing merge
33
33
34 $ hg up -qC 2
34 $ hg up -qC 2
35 $ hg merge --tool=internal:fail 1
35 $ hg merge --tool=internal:fail 1
36 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
36 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
37 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
37 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
38 [1]
38 [1]
39
39
40 resolve -l should contain unresolved entries
40 resolve -l should contain unresolved entries
41
41
42 $ hg resolve -l
42 $ hg resolve -l
43 U file1
43 U file1
44 U file2
44 U file2
45
45
46 $ hg resolve -l --no-status
46 $ hg resolve -l --no-status
47 file1
47 file1
48 file2
48 file2
49
49
50 resolving an unknown path should emit a warning, but not for -l
50 resolving an unknown path should emit a warning, but not for -l
51
51
52 $ hg resolve -m does-not-exist
52 $ hg resolve -m does-not-exist
53 arguments do not match paths that need resolving
53 arguments do not match paths that need resolving
54 $ hg resolve -l does-not-exist
54 $ hg resolve -l does-not-exist
55
55
56 tell users how they could have used resolve
56 tell users how they could have used resolve
57
57
58 $ mkdir nested
58 $ mkdir nested
59 $ cd nested
59 $ cd nested
60 $ hg resolve -m file1
60 $ hg resolve -m file1
61 arguments do not match paths that need resolving
61 arguments do not match paths that need resolving
62 (try: hg resolve -m path:file1)
62 (try: hg resolve -m path:file1)
63 $ hg resolve -m file1 filez
63 $ hg resolve -m file1 filez
64 arguments do not match paths that need resolving
64 arguments do not match paths that need resolving
65 (try: hg resolve -m path:file1 path:filez)
65 (try: hg resolve -m path:file1 path:filez)
66 $ hg resolve -m path:file1 path:filez
66 $ hg resolve -m path:file1 path:filez
67 $ hg resolve -l
67 $ hg resolve -l
68 R file1
68 R file1
69 U file2
69 U file2
70 $ hg resolve -m filez file2
70 $ hg resolve -m filez file2
71 arguments do not match paths that need resolving
71 arguments do not match paths that need resolving
72 (try: hg resolve -m path:filez path:file2)
72 (try: hg resolve -m path:filez path:file2)
73 $ hg resolve -m path:filez path:file2
73 $ hg resolve -m path:filez path:file2
74 (no more unresolved files)
74 (no more unresolved files)
75 $ hg resolve -l
75 $ hg resolve -l
76 R file1
76 R file1
77 R file2
77 R file2
78
78
79 cleanup
79 cleanup
80 $ hg resolve -u
80 $ hg resolve -u
81 $ cd ..
81 $ cd ..
82 $ rmdir nested
82 $ rmdir nested
83
83
84 don't allow marking or unmarking driver-resolved files
84 don't allow marking or unmarking driver-resolved files
85
85
86 $ cat > $TESTTMP/markdriver.py << EOF
86 $ cat > $TESTTMP/markdriver.py << EOF
87 > '''mark and unmark files as driver-resolved'''
87 > '''mark and unmark files as driver-resolved'''
88 > from mercurial import merge, registrar, scmutil, pycompat
88 > from mercurial import (
89 > merge,
90 > pycompat,
91 > registrar,
92 > scmutil,
93 > )
89 > cmdtable = {}
94 > cmdtable = {}
90 > command = registrar.command(cmdtable)
95 > command = registrar.command(cmdtable)
91 > @command(b'markdriver',
96 > @command(b'markdriver',
92 > [(b'u', b'unmark', None, b'')],
97 > [(b'u', b'unmark', None, b'')],
93 > b'FILE...')
98 > b'FILE...')
94 > def markdriver(ui, repo, *pats, **opts):
99 > def markdriver(ui, repo, *pats, **opts):
95 > wlock = repo.wlock()
100 > wlock = repo.wlock()
96 > opts = pycompat.byteskwargs(opts)
101 > opts = pycompat.byteskwargs(opts)
97 > try:
102 > try:
98 > ms = merge.mergestate.read(repo)
103 > ms = merge.mergestate.read(repo)
99 > m = scmutil.match(repo[None], pats, opts)
104 > m = scmutil.match(repo[None], pats, opts)
100 > for f in ms:
105 > for f in ms:
101 > if not m(f):
106 > if not m(f):
102 > continue
107 > continue
103 > if not opts[b'unmark']:
108 > if not opts[b'unmark']:
104 > ms.mark(f, b'd')
109 > ms.mark(f, b'd')
105 > else:
110 > else:
106 > ms.mark(f, b'u')
111 > ms.mark(f, b'u')
107 > ms.commit()
112 > ms.commit()
108 > finally:
113 > finally:
109 > wlock.release()
114 > wlock.release()
110 > EOF
115 > EOF
111 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver file1
116 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver file1
112 $ hg resolve --list
117 $ hg resolve --list
113 D file1
118 D file1
114 U file2
119 U file2
115 $ hg resolve --mark file1
120 $ hg resolve --mark file1
116 not marking file1 as it is driver-resolved
121 not marking file1 as it is driver-resolved
117 this should not print out file1
122 this should not print out file1
118 $ hg resolve --mark --all
123 $ hg resolve --mark --all
119 (no more unresolved files -- run "hg resolve --all" to conclude)
124 (no more unresolved files -- run "hg resolve --all" to conclude)
120 $ hg resolve --mark 'glob:file*'
125 $ hg resolve --mark 'glob:file*'
121 (no more unresolved files -- run "hg resolve --all" to conclude)
126 (no more unresolved files -- run "hg resolve --all" to conclude)
122 $ hg resolve --list
127 $ hg resolve --list
123 D file1
128 D file1
124 R file2
129 R file2
125 $ hg resolve --unmark file1
130 $ hg resolve --unmark file1
126 not unmarking file1 as it is driver-resolved
131 not unmarking file1 as it is driver-resolved
127 (no more unresolved files -- run "hg resolve --all" to conclude)
132 (no more unresolved files -- run "hg resolve --all" to conclude)
128 $ hg resolve --unmark --all
133 $ hg resolve --unmark --all
129 $ hg resolve --list
134 $ hg resolve --list
130 D file1
135 D file1
131 U file2
136 U file2
132 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver --unmark file1
137 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver --unmark file1
133 $ hg resolve --list
138 $ hg resolve --list
134 U file1
139 U file1
135 U file2
140 U file2
136
141
137 resolve the failure
142 resolve the failure
138
143
139 $ echo resolved > file1
144 $ echo resolved > file1
140 $ hg resolve -m file1
145 $ hg resolve -m file1
141
146
142 resolve -l should show resolved file as resolved
147 resolve -l should show resolved file as resolved
143
148
144 $ hg resolve -l
149 $ hg resolve -l
145 R file1
150 R file1
146 U file2
151 U file2
147
152
148 $ hg resolve -l -Tjson
153 $ hg resolve -l -Tjson
149 [
154 [
150 {
155 {
151 "path": "file1",
156 "path": "file1",
152 "status": "R"
157 "status": "R"
153 },
158 },
154 {
159 {
155 "path": "file2",
160 "path": "file2",
156 "status": "U"
161 "status": "U"
157 }
162 }
158 ]
163 ]
159
164
160 resolve -m without paths should mark all resolved
165 resolve -m without paths should mark all resolved
161
166
162 $ hg resolve -m
167 $ hg resolve -m
163 (no more unresolved files)
168 (no more unresolved files)
164 $ hg commit -m 'resolved'
169 $ hg commit -m 'resolved'
165
170
166 resolve -l should be empty after commit
171 resolve -l should be empty after commit
167
172
168 $ hg resolve -l
173 $ hg resolve -l
169
174
170 $ hg resolve -l -Tjson
175 $ hg resolve -l -Tjson
171 [
176 [
172 ]
177 ]
173
178
174 resolve --all should abort when no merge in progress
179 resolve --all should abort when no merge in progress
175
180
176 $ hg resolve --all
181 $ hg resolve --all
177 abort: resolve command not applicable when not merging
182 abort: resolve command not applicable when not merging
178 [255]
183 [255]
179
184
180 resolve -m should abort when no merge in progress
185 resolve -m should abort when no merge in progress
181
186
182 $ hg resolve -m
187 $ hg resolve -m
183 abort: resolve command not applicable when not merging
188 abort: resolve command not applicable when not merging
184 [255]
189 [255]
185
190
186 can not update or merge when there are unresolved conflicts
191 can not update or merge when there are unresolved conflicts
187
192
188 $ hg up -qC 0
193 $ hg up -qC 0
189 $ echo quux >> file1
194 $ echo quux >> file1
190 $ hg up 1
195 $ hg up 1
191 merging file1
196 merging file1
192 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
197 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
193 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
198 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
194 use 'hg resolve' to retry unresolved file merges
199 use 'hg resolve' to retry unresolved file merges
195 [1]
200 [1]
196 $ hg up 0
201 $ hg up 0
197 abort: outstanding merge conflicts
202 abort: outstanding merge conflicts
198 [255]
203 [255]
199 $ hg merge 2
204 $ hg merge 2
200 abort: outstanding merge conflicts
205 abort: outstanding merge conflicts
201 [255]
206 [255]
202 $ hg merge --force 2
207 $ hg merge --force 2
203 abort: outstanding merge conflicts
208 abort: outstanding merge conflicts
204 [255]
209 [255]
205
210
206 set up conflict-free merge
211 set up conflict-free merge
207
212
208 $ hg up -qC 3
213 $ hg up -qC 3
209 $ hg merge 1
214 $ hg merge 1
210 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 (branch merge, don't forget to commit)
216 (branch merge, don't forget to commit)
212
217
213 resolve --all should do nothing in merge without conflicts
218 resolve --all should do nothing in merge without conflicts
214 $ hg resolve --all
219 $ hg resolve --all
215 (no more unresolved files)
220 (no more unresolved files)
216
221
217 resolve -m should do nothing in merge without conflicts
222 resolve -m should do nothing in merge without conflicts
218
223
219 $ hg resolve -m
224 $ hg resolve -m
220 (no more unresolved files)
225 (no more unresolved files)
221
226
222 get back to conflicting state
227 get back to conflicting state
223
228
224 $ hg up -qC 2
229 $ hg up -qC 2
225 $ hg merge --tool=internal:fail 1
230 $ hg merge --tool=internal:fail 1
226 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
231 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
227 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
232 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
228 [1]
233 [1]
229
234
230 resolve without arguments should suggest --all
235 resolve without arguments should suggest --all
231 $ hg resolve
236 $ hg resolve
232 abort: no files or directories specified
237 abort: no files or directories specified
233 (use --all to re-merge all unresolved files)
238 (use --all to re-merge all unresolved files)
234 [255]
239 [255]
235
240
236 resolve --all should re-merge all unresolved files
241 resolve --all should re-merge all unresolved files
237 $ hg resolve --all
242 $ hg resolve --all
238 merging file1
243 merging file1
239 merging file2
244 merging file2
240 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
245 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
241 warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
246 warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
242 [1]
247 [1]
243 $ cat file1.orig
248 $ cat file1.orig
244 foo
249 foo
245 baz
250 baz
246 $ cat file2.orig
251 $ cat file2.orig
247 foo
252 foo
248 baz
253 baz
249
254
250 .orig files should exists where specified
255 .orig files should exists where specified
251 $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
256 $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
252 merging file1
257 merging file1
253 creating directory: $TESTTMP/repo/.hg/origbackups
258 creating directory: $TESTTMP/repo/.hg/origbackups
254 merging file2
259 merging file2
255 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
260 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
256 warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
261 warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
257 [1]
262 [1]
258 $ ls .hg/origbackups
263 $ ls .hg/origbackups
259 file1
264 file1
260 file2
265 file2
261 $ grep '<<<' file1 > /dev/null
266 $ grep '<<<' file1 > /dev/null
262 $ grep '<<<' file2 > /dev/null
267 $ grep '<<<' file2 > /dev/null
263
268
264 resolve <file> should re-merge file
269 resolve <file> should re-merge file
265 $ echo resolved > file1
270 $ echo resolved > file1
266 $ hg resolve -q file1
271 $ hg resolve -q file1
267 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
272 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
268 [1]
273 [1]
269 $ grep '<<<' file1 > /dev/null
274 $ grep '<<<' file1 > /dev/null
270
275
271 test .orig behavior with resolve
276 test .orig behavior with resolve
272
277
273 $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'"
278 $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'"
274 $TESTTMP/repo/file1.orig:
279 $TESTTMP/repo/file1.orig:
275 >>>
280 >>>
276 foo
281 foo
277 baz
282 baz
278 <<<
283 <<<
279
284
280 resolve <file> should do nothing if 'file' was marked resolved
285 resolve <file> should do nothing if 'file' was marked resolved
281 $ echo resolved > file1
286 $ echo resolved > file1
282 $ hg resolve -m file1
287 $ hg resolve -m file1
283 $ hg resolve -q file1
288 $ hg resolve -q file1
284 $ cat file1
289 $ cat file1
285 resolved
290 resolved
286
291
287 insert unsupported advisory merge record
292 insert unsupported advisory merge record
288
293
289 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
294 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
290 $ hg debugmergestate
295 $ hg debugmergestate
291 * version 2 records
296 * version 2 records
292 local: 57653b9f834a4493f7240b0681efcb9ae7cab745
297 local: 57653b9f834a4493f7240b0681efcb9ae7cab745
293 other: dc77451844e37f03f5c559e3b8529b2b48d381d1
298 other: dc77451844e37f03f5c559e3b8529b2b48d381d1
294 labels:
299 labels:
295 local: working copy
300 local: working copy
296 other: merge rev
301 other: merge rev
297 unrecognized entry: x advisory record
302 unrecognized entry: x advisory record
298 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
303 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
299 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
304 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
300 local path: file1 (flags "")
305 local path: file1 (flags "")
301 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
306 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
302 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
307 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
303 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
308 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
304 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
309 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
305 local path: file2 (flags "")
310 local path: file2 (flags "")
306 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
311 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
307 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
312 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
308 $ hg resolve -l
313 $ hg resolve -l
309 R file1
314 R file1
310 U file2
315 U file2
311
316
312 insert unsupported mandatory merge record
317 insert unsupported mandatory merge record
313
318
314 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
319 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
315 $ hg debugmergestate
320 $ hg debugmergestate
316 * version 2 records
321 * version 2 records
317 local: 57653b9f834a4493f7240b0681efcb9ae7cab745
322 local: 57653b9f834a4493f7240b0681efcb9ae7cab745
318 other: dc77451844e37f03f5c559e3b8529b2b48d381d1
323 other: dc77451844e37f03f5c559e3b8529b2b48d381d1
319 labels:
324 labels:
320 local: working copy
325 local: working copy
321 other: merge rev
326 other: merge rev
322 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
327 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
323 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
328 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
324 local path: file1 (flags "")
329 local path: file1 (flags "")
325 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
330 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
326 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
331 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
327 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
332 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
328 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
333 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
329 local path: file2 (flags "")
334 local path: file2 (flags "")
330 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
335 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
331 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
336 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
332 unrecognized entry: X mandatory record
337 unrecognized entry: X mandatory record
333 $ hg resolve -l
338 $ hg resolve -l
334 abort: unsupported merge state records: X
339 abort: unsupported merge state records: X
335 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
340 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
336 [255]
341 [255]
337 $ hg resolve -ma
342 $ hg resolve -ma
338 abort: unsupported merge state records: X
343 abort: unsupported merge state records: X
339 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
344 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
340 [255]
345 [255]
341 $ hg summary
346 $ hg summary
342 warning: merge state has unsupported record types: X
347 warning: merge state has unsupported record types: X
343 parent: 2:57653b9f834a
348 parent: 2:57653b9f834a
344 append baz to files
349 append baz to files
345 parent: 1:dc77451844e3
350 parent: 1:dc77451844e3
346 append bar to files
351 append bar to files
347 branch: default
352 branch: default
348 commit: 2 modified, 2 unknown (merge)
353 commit: 2 modified, 2 unknown (merge)
349 update: 2 new changesets (update)
354 update: 2 new changesets (update)
350 phases: 5 draft
355 phases: 5 draft
351
356
352 update --clean shouldn't abort on unsupported records
357 update --clean shouldn't abort on unsupported records
353
358
354 $ hg up -qC 1
359 $ hg up -qC 1
355 $ hg debugmergestate
360 $ hg debugmergestate
356 no merge state found
361 no merge state found
357
362
358 test crashed merge with empty mergestate
363 test crashed merge with empty mergestate
359
364
360 $ mkdir .hg/merge
365 $ mkdir .hg/merge
361 $ touch .hg/merge/state
366 $ touch .hg/merge/state
362
367
363 resolve -l should be empty
368 resolve -l should be empty
364
369
365 $ hg resolve -l
370 $ hg resolve -l
366
371
367 $ cd ..
372 $ cd ..
@@ -1,466 +1,466 b''
1 setup repo
1 setup repo
2 $ hg init t
2 $ hg init t
3 $ cd t
3 $ cd t
4 $ echo a > a
4 $ echo a > a
5 $ hg commit -Am'add a'
5 $ hg commit -Am'add a'
6 adding a
6 adding a
7 $ hg verify
7 $ hg verify
8 checking changesets
8 checking changesets
9 checking manifests
9 checking manifests
10 crosschecking files in changesets and manifests
10 crosschecking files in changesets and manifests
11 checking files
11 checking files
12 1 files, 1 changesets, 1 total revisions
12 1 files, 1 changesets, 1 total revisions
13 $ hg parents
13 $ hg parents
14 changeset: 0:1f0dee641bb7
14 changeset: 0:1f0dee641bb7
15 tag: tip
15 tag: tip
16 user: test
16 user: test
17 date: Thu Jan 01 00:00:00 1970 +0000
17 date: Thu Jan 01 00:00:00 1970 +0000
18 summary: add a
18 summary: add a
19
19
20
20
21 rollback to null revision
21 rollback to null revision
22 $ hg status
22 $ hg status
23 $ hg rollback
23 $ hg rollback
24 repository tip rolled back to revision -1 (undo commit)
24 repository tip rolled back to revision -1 (undo commit)
25 working directory now based on revision -1
25 working directory now based on revision -1
26 $ hg verify
26 $ hg verify
27 checking changesets
27 checking changesets
28 checking manifests
28 checking manifests
29 crosschecking files in changesets and manifests
29 crosschecking files in changesets and manifests
30 checking files
30 checking files
31 0 files, 0 changesets, 0 total revisions
31 0 files, 0 changesets, 0 total revisions
32 $ hg parents
32 $ hg parents
33 $ hg status
33 $ hg status
34 A a
34 A a
35
35
36 Two changesets this time so we rollback to a real changeset
36 Two changesets this time so we rollback to a real changeset
37 $ hg commit -m'add a again'
37 $ hg commit -m'add a again'
38 $ echo a >> a
38 $ echo a >> a
39 $ hg commit -m'modify a'
39 $ hg commit -m'modify a'
40
40
41 Test issue 902 (current branch is preserved)
41 Test issue 902 (current branch is preserved)
42 $ hg branch test
42 $ hg branch test
43 marked working directory as branch test
43 marked working directory as branch test
44 (branches are permanent and global, did you want a bookmark?)
44 (branches are permanent and global, did you want a bookmark?)
45 $ hg rollback
45 $ hg rollback
46 repository tip rolled back to revision 0 (undo commit)
46 repository tip rolled back to revision 0 (undo commit)
47 working directory now based on revision 0
47 working directory now based on revision 0
48 $ hg branch
48 $ hg branch
49 default
49 default
50
50
51 Test issue 1635 (commit message saved)
51 Test issue 1635 (commit message saved)
52 $ cat .hg/last-message.txt ; echo
52 $ cat .hg/last-message.txt ; echo
53 modify a
53 modify a
54
54
55 Test rollback of hg before issue 902 was fixed
55 Test rollback of hg before issue 902 was fixed
56
56
57 $ hg commit -m "test3"
57 $ hg commit -m "test3"
58 $ hg branch test
58 $ hg branch test
59 marked working directory as branch test
59 marked working directory as branch test
60 (branches are permanent and global, did you want a bookmark?)
60 (branches are permanent and global, did you want a bookmark?)
61 $ rm .hg/undo.branch
61 $ rm .hg/undo.branch
62 $ hg rollback
62 $ hg rollback
63 repository tip rolled back to revision 0 (undo commit)
63 repository tip rolled back to revision 0 (undo commit)
64 named branch could not be reset: current branch is still 'test'
64 named branch could not be reset: current branch is still 'test'
65 working directory now based on revision 0
65 working directory now based on revision 0
66 $ hg branch
66 $ hg branch
67 test
67 test
68
68
69 working dir unaffected by rollback: do not restore dirstate et. al.
69 working dir unaffected by rollback: do not restore dirstate et. al.
70 $ hg log --template '{rev} {branch} {desc|firstline}\n'
70 $ hg log --template '{rev} {branch} {desc|firstline}\n'
71 0 default add a again
71 0 default add a again
72 $ hg status
72 $ hg status
73 M a
73 M a
74 $ hg bookmark foo
74 $ hg bookmark foo
75 $ hg commit -m'modify a again'
75 $ hg commit -m'modify a again'
76 $ echo b > b
76 $ echo b > b
77 $ hg bookmark bar -r default #making bar active, before the transaction
77 $ hg bookmark bar -r default #making bar active, before the transaction
78 $ hg commit -Am'add b'
78 $ hg commit -Am'add b'
79 adding b
79 adding b
80 $ hg log --template '{rev} {branch} {desc|firstline}\n'
80 $ hg log --template '{rev} {branch} {desc|firstline}\n'
81 2 test add b
81 2 test add b
82 1 test modify a again
82 1 test modify a again
83 0 default add a again
83 0 default add a again
84 $ hg update bar
84 $ hg update bar
85 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
85 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
86 (activating bookmark bar)
86 (activating bookmark bar)
87 $ cat .hg/undo.branch ; echo
87 $ cat .hg/undo.branch ; echo
88 test
88 test
89 $ hg rollback -f
89 $ hg rollback -f
90 repository tip rolled back to revision 1 (undo commit)
90 repository tip rolled back to revision 1 (undo commit)
91 $ hg id -n
91 $ hg id -n
92 0
92 0
93 $ hg branch
93 $ hg branch
94 default
94 default
95 $ cat .hg/bookmarks.current ; echo
95 $ cat .hg/bookmarks.current ; echo
96 bar
96 bar
97 $ hg bookmark --delete foo bar
97 $ hg bookmark --delete foo bar
98
98
99 rollback by pretxncommit saves commit message (issue1635)
99 rollback by pretxncommit saves commit message (issue1635)
100
100
101 $ echo a >> a
101 $ echo a >> a
102 $ hg --config hooks.pretxncommit=false commit -m"precious commit message"
102 $ hg --config hooks.pretxncommit=false commit -m"precious commit message"
103 transaction abort!
103 transaction abort!
104 rollback completed
104 rollback completed
105 abort: pretxncommit hook exited with status * (glob)
105 abort: pretxncommit hook exited with status * (glob)
106 [255]
106 [255]
107 $ cat .hg/last-message.txt ; echo
107 $ cat .hg/last-message.txt ; echo
108 precious commit message
108 precious commit message
109
109
110 same thing, but run $EDITOR
110 same thing, but run $EDITOR
111
111
112 $ cat > editor.sh << '__EOF__'
112 $ cat > editor.sh << '__EOF__'
113 > echo "another precious commit message" > "$1"
113 > echo "another precious commit message" > "$1"
114 > __EOF__
114 > __EOF__
115 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1
115 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1
116 note: commit message saved in .hg/last-message.txt
116 note: commit message saved in .hg/last-message.txt
117 transaction abort!
117 transaction abort!
118 rollback completed
118 rollback completed
119 abort: pretxncommit hook exited with status * (glob)
119 abort: pretxncommit hook exited with status * (glob)
120 [255]
120 [255]
121 $ cat .hg/last-message.txt
121 $ cat .hg/last-message.txt
122 another precious commit message
122 another precious commit message
123
123
124 test rollback on served repository
124 test rollback on served repository
125
125
126 #if serve
126 #if serve
127 $ hg commit -m "precious commit message"
127 $ hg commit -m "precious commit message"
128 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
128 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
129 $ cat hg.pid >> $DAEMON_PIDS
129 $ cat hg.pid >> $DAEMON_PIDS
130 $ cd ..
130 $ cd ..
131 $ hg clone http://localhost:$HGPORT u
131 $ hg clone http://localhost:$HGPORT u
132 requesting all changes
132 requesting all changes
133 adding changesets
133 adding changesets
134 adding manifests
134 adding manifests
135 adding file changes
135 adding file changes
136 added 3 changesets with 2 changes to 1 files (+1 heads)
136 added 3 changesets with 2 changes to 1 files (+1 heads)
137 new changesets 23b0221f3370:068774709090
137 new changesets 23b0221f3370:068774709090
138 updating to branch default
138 updating to branch default
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ cd u
140 $ cd u
141 $ hg id default
141 $ hg id default
142 068774709090
142 068774709090
143
143
144 now rollback and observe that 'hg serve' reloads the repository and
144 now rollback and observe that 'hg serve' reloads the repository and
145 presents the correct tip changeset:
145 presents the correct tip changeset:
146
146
147 $ hg -R ../t rollback
147 $ hg -R ../t rollback
148 repository tip rolled back to revision 1 (undo commit)
148 repository tip rolled back to revision 1 (undo commit)
149 working directory now based on revision 0
149 working directory now based on revision 0
150 $ hg id default
150 $ hg id default
151 791dd2169706
151 791dd2169706
152
152
153 $ killdaemons.py
153 $ killdaemons.py
154 #endif
154 #endif
155
155
156 update to older changeset and then refuse rollback, because
156 update to older changeset and then refuse rollback, because
157 that would lose data (issue2998)
157 that would lose data (issue2998)
158 $ cd ../t
158 $ cd ../t
159 $ hg -q update
159 $ hg -q update
160 $ rm `hg status -un`
160 $ rm `hg status -un`
161 $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n'
161 $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n'
162 $ echo 'valuable new file' > b
162 $ echo 'valuable new file' > b
163 $ echo 'valuable modification' >> a
163 $ echo 'valuable modification' >> a
164 $ hg commit -A -m'a valuable change'
164 $ hg commit -A -m'a valuable change'
165 adding b
165 adding b
166 $ hg update 0
166 $ hg update 0
167 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
167 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
168 $ hg rollback
168 $ hg rollback
169 abort: rollback of last commit while not checked out may lose data
169 abort: rollback of last commit while not checked out may lose data
170 (use -f to force)
170 (use -f to force)
171 [255]
171 [255]
172 $ hg tip -q
172 $ hg tip -q
173 2:4d9cd3795eea
173 2:4d9cd3795eea
174 $ hg rollback -f
174 $ hg rollback -f
175 repository tip rolled back to revision 1 (undo commit)
175 repository tip rolled back to revision 1 (undo commit)
176 $ hg status
176 $ hg status
177 $ hg log --removed b # yep, it's gone
177 $ hg log --removed b # yep, it's gone
178
178
179 same again, but emulate an old client that doesn't write undo.desc
179 same again, but emulate an old client that doesn't write undo.desc
180 $ hg -q update
180 $ hg -q update
181 $ echo 'valuable modification redux' >> a
181 $ echo 'valuable modification redux' >> a
182 $ hg commit -m'a valuable change redux'
182 $ hg commit -m'a valuable change redux'
183 $ rm .hg/undo.desc
183 $ rm .hg/undo.desc
184 $ hg update 0
184 $ hg update 0
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 $ hg rollback
186 $ hg rollback
187 rolling back unknown transaction
187 rolling back unknown transaction
188 $ cat a
188 $ cat a
189 a
189 a
190
190
191 corrupt journal test
191 corrupt journal test
192 $ echo "foo" > .hg/store/journal
192 $ echo "foo" > .hg/store/journal
193 $ hg recover
193 $ hg recover
194 rolling back interrupted transaction
194 rolling back interrupted transaction
195 couldn't read journal entry 'foo\n'!
195 couldn't read journal entry 'foo\n'!
196 checking changesets
196 checking changesets
197 checking manifests
197 checking manifests
198 crosschecking files in changesets and manifests
198 crosschecking files in changesets and manifests
199 checking files
199 checking files
200 1 files, 2 changesets, 2 total revisions
200 1 files, 2 changesets, 2 total revisions
201
201
202 rollback disabled by config
202 rollback disabled by config
203 $ cat >> $HGRCPATH <<EOF
203 $ cat >> $HGRCPATH <<EOF
204 > [ui]
204 > [ui]
205 > rollback = false
205 > rollback = false
206 > EOF
206 > EOF
207 $ echo narf >> pinky-sayings.txt
207 $ echo narf >> pinky-sayings.txt
208 $ hg add pinky-sayings.txt
208 $ hg add pinky-sayings.txt
209 $ hg ci -m 'First one.'
209 $ hg ci -m 'First one.'
210 $ hg rollback
210 $ hg rollback
211 abort: rollback is disabled because it is unsafe
211 abort: rollback is disabled because it is unsafe
212 (see `hg help -v rollback` for information)
212 (see `hg help -v rollback` for information)
213 [255]
213 [255]
214
214
215 $ cd ..
215 $ cd ..
216
216
217 I/O errors on stdio are handled properly (issue5658)
217 I/O errors on stdio are handled properly (issue5658)
218
218
219 $ cat > badui.py << EOF
219 $ cat > badui.py << EOF
220 > import errno
220 > import errno
221 > from mercurial.i18n import _
221 > from mercurial.i18n import _
222 > from mercurial import (
222 > from mercurial import (
223 > error,
223 > registrar,
224 > registrar,
224 > error,
225 > ui as uimod,
225 > ui as uimod,
226 > )
226 > )
227 >
227 >
228 > configtable = {}
228 > configtable = {}
229 > configitem = registrar.configitem(configtable)
229 > configitem = registrar.configitem(configtable)
230 >
230 >
231 > configitem(b'ui', b'ioerrors',
231 > configitem(b'ui', b'ioerrors',
232 > default=list,
232 > default=list,
233 > )
233 > )
234 >
234 >
235 > def pretxncommit(ui, repo, **kwargs):
235 > def pretxncommit(ui, repo, **kwargs):
236 > ui.warn(b'warn during pretxncommit\n')
236 > ui.warn(b'warn during pretxncommit\n')
237 >
237 >
238 > def pretxnclose(ui, repo, **kwargs):
238 > def pretxnclose(ui, repo, **kwargs):
239 > ui.warn(b'warn during pretxnclose\n')
239 > ui.warn(b'warn during pretxnclose\n')
240 >
240 >
241 > def txnclose(ui, repo, **kwargs):
241 > def txnclose(ui, repo, **kwargs):
242 > ui.warn(b'warn during txnclose\n')
242 > ui.warn(b'warn during txnclose\n')
243 >
243 >
244 > def txnabort(ui, repo, **kwargs):
244 > def txnabort(ui, repo, **kwargs):
245 > ui.warn(b'warn during abort\n')
245 > ui.warn(b'warn during abort\n')
246 >
246 >
247 > class fdproxy(object):
247 > class fdproxy(object):
248 > def __init__(self, ui, o):
248 > def __init__(self, ui, o):
249 > self._ui = ui
249 > self._ui = ui
250 > self._o = o
250 > self._o = o
251 >
251 >
252 > def __getattr__(self, attr):
252 > def __getattr__(self, attr):
253 > return getattr(self._o, attr)
253 > return getattr(self._o, attr)
254 >
254 >
255 > def write(self, msg):
255 > def write(self, msg):
256 > errors = set(self._ui.configlist(b'ui', b'ioerrors'))
256 > errors = set(self._ui.configlist(b'ui', b'ioerrors'))
257 > pretxncommit = msg == b'warn during pretxncommit\n'
257 > pretxncommit = msg == b'warn during pretxncommit\n'
258 > pretxnclose = msg == b'warn during pretxnclose\n'
258 > pretxnclose = msg == b'warn during pretxnclose\n'
259 > txnclose = msg == b'warn during txnclose\n'
259 > txnclose = msg == b'warn during txnclose\n'
260 > txnabort = msg == b'warn during abort\n'
260 > txnabort = msg == b'warn during abort\n'
261 > msgabort = msg == _(b'transaction abort!\n')
261 > msgabort = msg == _(b'transaction abort!\n')
262 > msgrollback = msg == _(b'rollback completed\n')
262 > msgrollback = msg == _(b'rollback completed\n')
263 >
263 >
264 > if pretxncommit and b'pretxncommit' in errors:
264 > if pretxncommit and b'pretxncommit' in errors:
265 > raise IOError(errno.EPIPE, 'simulated epipe')
265 > raise IOError(errno.EPIPE, 'simulated epipe')
266 > if pretxnclose and b'pretxnclose' in errors:
266 > if pretxnclose and b'pretxnclose' in errors:
267 > raise IOError(errno.EIO, 'simulated eio')
267 > raise IOError(errno.EIO, 'simulated eio')
268 > if txnclose and b'txnclose' in errors:
268 > if txnclose and b'txnclose' in errors:
269 > raise IOError(errno.EBADF, 'simulated badf')
269 > raise IOError(errno.EBADF, 'simulated badf')
270 > if txnabort and b'txnabort' in errors:
270 > if txnabort and b'txnabort' in errors:
271 > raise IOError(errno.EPIPE, 'simulated epipe')
271 > raise IOError(errno.EPIPE, 'simulated epipe')
272 > if msgabort and b'msgabort' in errors:
272 > if msgabort and b'msgabort' in errors:
273 > raise IOError(errno.EBADF, 'simulated ebadf')
273 > raise IOError(errno.EBADF, 'simulated ebadf')
274 > if msgrollback and b'msgrollback' in errors:
274 > if msgrollback and b'msgrollback' in errors:
275 > raise IOError(errno.EIO, 'simulated eio')
275 > raise IOError(errno.EIO, 'simulated eio')
276 >
276 >
277 > return self._o.write(msg)
277 > return self._o.write(msg)
278 >
278 >
279 > def uisetup(ui):
279 > def uisetup(ui):
280 > class badui(ui.__class__):
280 > class badui(ui.__class__):
281 > def write_err(self, *args, **kwargs):
281 > def write_err(self, *args, **kwargs):
282 > olderr = self.ferr
282 > olderr = self.ferr
283 > try:
283 > try:
284 > self.ferr = fdproxy(self, olderr)
284 > self.ferr = fdproxy(self, olderr)
285 > return super(badui, self).write_err(*args, **kwargs)
285 > return super(badui, self).write_err(*args, **kwargs)
286 > finally:
286 > finally:
287 > self.ferr = olderr
287 > self.ferr = olderr
288 >
288 >
289 > ui.__class__ = badui
289 > ui.__class__ = badui
290 >
290 >
291 > def reposetup(ui, repo):
291 > def reposetup(ui, repo):
292 > ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui')
292 > ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui')
293 > ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui')
293 > ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui')
294 > ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui')
294 > ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui')
295 > ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui')
295 > ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui')
296 > EOF
296 > EOF
297
297
298 $ cat >> $HGRCPATH << EOF
298 $ cat >> $HGRCPATH << EOF
299 > [extensions]
299 > [extensions]
300 > badui = $TESTTMP/badui.py
300 > badui = $TESTTMP/badui.py
301 > EOF
301 > EOF
302
302
303 An I/O error during pretxncommit is handled
303 An I/O error during pretxncommit is handled
304
304
305 $ hg init ioerror-pretxncommit
305 $ hg init ioerror-pretxncommit
306 $ cd ioerror-pretxncommit
306 $ cd ioerror-pretxncommit
307 $ echo 0 > foo
307 $ echo 0 > foo
308 $ hg -q commit -A -m initial
308 $ hg -q commit -A -m initial
309 warn during pretxncommit
309 warn during pretxncommit
310 warn during pretxnclose
310 warn during pretxnclose
311 warn during txnclose
311 warn during txnclose
312 $ echo 1 > foo
312 $ echo 1 > foo
313 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
313 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
314 warn during pretxnclose
314 warn during pretxnclose
315 warn during txnclose
315 warn during txnclose
316
316
317 $ hg commit -m 'commit 1'
317 $ hg commit -m 'commit 1'
318 nothing changed
318 nothing changed
319 [1]
319 [1]
320
320
321 $ cd ..
321 $ cd ..
322
322
323 An I/O error during pretxnclose is handled
323 An I/O error during pretxnclose is handled
324
324
325 $ hg init ioerror-pretxnclose
325 $ hg init ioerror-pretxnclose
326 $ cd ioerror-pretxnclose
326 $ cd ioerror-pretxnclose
327 $ echo 0 > foo
327 $ echo 0 > foo
328 $ hg -q commit -A -m initial
328 $ hg -q commit -A -m initial
329 warn during pretxncommit
329 warn during pretxncommit
330 warn during pretxnclose
330 warn during pretxnclose
331 warn during txnclose
331 warn during txnclose
332
332
333 $ echo 1 > foo
333 $ echo 1 > foo
334 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
334 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
335 warn during pretxncommit
335 warn during pretxncommit
336 warn during txnclose
336 warn during txnclose
337
337
338 $ hg commit -m 'commit 1'
338 $ hg commit -m 'commit 1'
339 nothing changed
339 nothing changed
340 [1]
340 [1]
341
341
342 $ cd ..
342 $ cd ..
343
343
344 An I/O error during txnclose is handled
344 An I/O error during txnclose is handled
345
345
346 $ hg init ioerror-txnclose
346 $ hg init ioerror-txnclose
347 $ cd ioerror-txnclose
347 $ cd ioerror-txnclose
348 $ echo 0 > foo
348 $ echo 0 > foo
349 $ hg -q commit -A -m initial
349 $ hg -q commit -A -m initial
350 warn during pretxncommit
350 warn during pretxncommit
351 warn during pretxnclose
351 warn during pretxnclose
352 warn during txnclose
352 warn during txnclose
353
353
354 $ echo 1 > foo
354 $ echo 1 > foo
355 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
355 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
356 warn during pretxncommit
356 warn during pretxncommit
357 warn during pretxnclose
357 warn during pretxnclose
358
358
359 $ hg commit -m 'commit 1'
359 $ hg commit -m 'commit 1'
360 nothing changed
360 nothing changed
361 [1]
361 [1]
362
362
363 $ cd ..
363 $ cd ..
364
364
365 An I/O error writing "transaction abort" is handled
365 An I/O error writing "transaction abort" is handled
366
366
367 $ hg init ioerror-msgabort
367 $ hg init ioerror-msgabort
368 $ cd ioerror-msgabort
368 $ cd ioerror-msgabort
369
369
370 $ echo 0 > foo
370 $ echo 0 > foo
371 $ hg -q commit -A -m initial
371 $ hg -q commit -A -m initial
372 warn during pretxncommit
372 warn during pretxncommit
373 warn during pretxnclose
373 warn during pretxnclose
374 warn during txnclose
374 warn during txnclose
375
375
376 $ echo 1 > foo
376 $ echo 1 > foo
377 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
377 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
378 warn during abort
378 warn during abort
379 rollback completed
379 rollback completed
380 abort: pretxncommit hook exited with status 1
380 abort: pretxncommit hook exited with status 1
381 [255]
381 [255]
382
382
383 $ hg commit -m 'commit 1'
383 $ hg commit -m 'commit 1'
384 warn during pretxncommit
384 warn during pretxncommit
385 warn during pretxnclose
385 warn during pretxnclose
386 warn during txnclose
386 warn during txnclose
387
387
388 $ cd ..
388 $ cd ..
389
389
390 An I/O error during txnabort should still result in rollback
390 An I/O error during txnabort should still result in rollback
391
391
392 $ hg init ioerror-txnabort
392 $ hg init ioerror-txnabort
393 $ cd ioerror-txnabort
393 $ cd ioerror-txnabort
394
394
395 $ echo 0 > foo
395 $ echo 0 > foo
396 $ hg -q commit -A -m initial
396 $ hg -q commit -A -m initial
397 warn during pretxncommit
397 warn during pretxncommit
398 warn during pretxnclose
398 warn during pretxnclose
399 warn during txnclose
399 warn during txnclose
400
400
401 $ echo 1 > foo
401 $ echo 1 > foo
402 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
402 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
403 transaction abort!
403 transaction abort!
404 rollback completed
404 rollback completed
405 abort: pretxncommit hook exited with status 1
405 abort: pretxncommit hook exited with status 1
406 [255]
406 [255]
407
407
408 $ hg commit -m 'commit 1'
408 $ hg commit -m 'commit 1'
409 warn during pretxncommit
409 warn during pretxncommit
410 warn during pretxnclose
410 warn during pretxnclose
411 warn during txnclose
411 warn during txnclose
412
412
413 $ cd ..
413 $ cd ..
414
414
415 An I/O error writing "rollback completed" is handled
415 An I/O error writing "rollback completed" is handled
416
416
417 $ hg init ioerror-msgrollback
417 $ hg init ioerror-msgrollback
418 $ cd ioerror-msgrollback
418 $ cd ioerror-msgrollback
419
419
420 $ echo 0 > foo
420 $ echo 0 > foo
421 $ hg -q commit -A -m initial
421 $ hg -q commit -A -m initial
422 warn during pretxncommit
422 warn during pretxncommit
423 warn during pretxnclose
423 warn during pretxnclose
424 warn during txnclose
424 warn during txnclose
425
425
426 $ echo 1 > foo
426 $ echo 1 > foo
427
427
428 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
428 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
429 transaction abort!
429 transaction abort!
430 warn during abort
430 warn during abort
431 abort: pretxncommit hook exited with status 1
431 abort: pretxncommit hook exited with status 1
432 [255]
432 [255]
433
433
434 $ hg verify
434 $ hg verify
435 checking changesets
435 checking changesets
436 checking manifests
436 checking manifests
437 crosschecking files in changesets and manifests
437 crosschecking files in changesets and manifests
438 checking files
438 checking files
439 1 files, 1 changesets, 1 total revisions
439 1 files, 1 changesets, 1 total revisions
440
440
441 $ cd ..
441 $ cd ..
442
442
443 Multiple I/O errors after transaction open are handled.
443 Multiple I/O errors after transaction open are handled.
444 This is effectively what happens if a peer disconnects in the middle
444 This is effectively what happens if a peer disconnects in the middle
445 of a transaction.
445 of a transaction.
446
446
447 $ hg init ioerror-multiple
447 $ hg init ioerror-multiple
448 $ cd ioerror-multiple
448 $ cd ioerror-multiple
449 $ echo 0 > foo
449 $ echo 0 > foo
450 $ hg -q commit -A -m initial
450 $ hg -q commit -A -m initial
451 warn during pretxncommit
451 warn during pretxncommit
452 warn during pretxnclose
452 warn during pretxnclose
453 warn during txnclose
453 warn during txnclose
454
454
455 $ echo 1 > foo
455 $ echo 1 > foo
456
456
457 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors'
457 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors'
458
458
459 $ hg verify
459 $ hg verify
460 checking changesets
460 checking changesets
461 checking manifests
461 checking manifests
462 crosschecking files in changesets and manifests
462 crosschecking files in changesets and manifests
463 checking files
463 checking files
464 1 files, 2 changesets, 2 total revisions
464 1 files, 2 changesets, 2 total revisions
465
465
466 $ cd ..
466 $ cd ..
@@ -1,530 +1,531 b''
1 #testcases obsstore-on obsstore-off
1 #testcases obsstore-on obsstore-off
2
2
3 $ cat > $TESTTMP/editor.py <<EOF
3 $ cat > $TESTTMP/editor.py <<EOF
4 > #!$PYTHON
4 > #!$PYTHON
5 > import os, sys
5 > import os
6 > import sys
6 > path = os.path.join(os.environ['TESTTMP'], 'messages')
7 > path = os.path.join(os.environ['TESTTMP'], 'messages')
7 > messages = open(path).read().split('--\n')
8 > messages = open(path).read().split('--\n')
8 > prompt = open(sys.argv[1]).read()
9 > prompt = open(sys.argv[1]).read()
9 > sys.stdout.write(''.join('EDITOR: %s' % l for l in prompt.splitlines(True)))
10 > sys.stdout.write(''.join('EDITOR: %s' % l for l in prompt.splitlines(True)))
10 > sys.stdout.flush()
11 > sys.stdout.flush()
11 > with open(sys.argv[1], 'w') as f:
12 > with open(sys.argv[1], 'w') as f:
12 > f.write(messages[0])
13 > f.write(messages[0])
13 > with open(path, 'w') as f:
14 > with open(path, 'w') as f:
14 > f.write('--\n'.join(messages[1:]))
15 > f.write('--\n'.join(messages[1:]))
15 > EOF
16 > EOF
16
17
17 $ cat >> $HGRCPATH <<EOF
18 $ cat >> $HGRCPATH <<EOF
18 > [extensions]
19 > [extensions]
19 > drawdag=$TESTDIR/drawdag.py
20 > drawdag=$TESTDIR/drawdag.py
20 > split=
21 > split=
21 > [ui]
22 > [ui]
22 > interactive=1
23 > interactive=1
23 > color=no
24 > color=no
24 > paginate=never
25 > paginate=never
25 > [diff]
26 > [diff]
26 > git=1
27 > git=1
27 > unified=0
28 > unified=0
28 > [alias]
29 > [alias]
29 > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n'
30 > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n'
30 > EOF
31 > EOF
31
32
32 #if obsstore-on
33 #if obsstore-on
33 $ cat >> $HGRCPATH <<EOF
34 $ cat >> $HGRCPATH <<EOF
34 > [experimental]
35 > [experimental]
35 > evolution=all
36 > evolution=all
36 > EOF
37 > EOF
37 #endif
38 #endif
38
39
39 $ hg init a
40 $ hg init a
40 $ cd a
41 $ cd a
41
42
42 Nothing to split
43 Nothing to split
43
44
44 $ hg split
45 $ hg split
45 nothing to split
46 nothing to split
46 [1]
47 [1]
47
48
48 $ hg commit -m empty --config ui.allowemptycommit=1
49 $ hg commit -m empty --config ui.allowemptycommit=1
49 $ hg split
50 $ hg split
50 abort: cannot split an empty revision
51 abort: cannot split an empty revision
51 [255]
52 [255]
52
53
53 $ rm -rf .hg
54 $ rm -rf .hg
54 $ hg init
55 $ hg init
55
56
56 Cannot split working directory
57 Cannot split working directory
57
58
58 $ hg split -r 'wdir()'
59 $ hg split -r 'wdir()'
59 abort: cannot split working directory
60 abort: cannot split working directory
60 [255]
61 [255]
61
62
62 Generate some content. The sed filter drop CR on Windows, which is dropped in
63 Generate some content. The sed filter drop CR on Windows, which is dropped in
63 the a > b line.
64 the a > b line.
64
65
65 $ $TESTDIR/seq.py 1 5 | sed 's/\r$//' >> a
66 $ $TESTDIR/seq.py 1 5 | sed 's/\r$//' >> a
66 $ hg ci -m a1 -A a -q
67 $ hg ci -m a1 -A a -q
67 $ hg bookmark -i r1
68 $ hg bookmark -i r1
68 $ sed 's/1/11/;s/3/33/;s/5/55/' a > b
69 $ sed 's/1/11/;s/3/33/;s/5/55/' a > b
69 $ mv b a
70 $ mv b a
70 $ hg ci -m a2 -q
71 $ hg ci -m a2 -q
71 $ hg bookmark -i r2
72 $ hg bookmark -i r2
72
73
73 Cannot split a public changeset
74 Cannot split a public changeset
74
75
75 $ hg phase --public -r 'all()'
76 $ hg phase --public -r 'all()'
76 $ hg split .
77 $ hg split .
77 abort: cannot split public changeset
78 abort: cannot split public changeset
78 (see 'hg help phases' for details)
79 (see 'hg help phases' for details)
79 [255]
80 [255]
80
81
81 $ hg phase --draft -f -r 'all()'
82 $ hg phase --draft -f -r 'all()'
82
83
83 Cannot split while working directory is dirty
84 Cannot split while working directory is dirty
84
85
85 $ touch dirty
86 $ touch dirty
86 $ hg add dirty
87 $ hg add dirty
87 $ hg split .
88 $ hg split .
88 abort: uncommitted changes
89 abort: uncommitted changes
89 [255]
90 [255]
90 $ hg forget dirty
91 $ hg forget dirty
91 $ rm dirty
92 $ rm dirty
92
93
93 Split a head
94 Split a head
94
95
95 $ cp -R . ../b
96 $ cp -R . ../b
96 $ cp -R . ../c
97 $ cp -R . ../c
97
98
98 $ hg bookmark r3
99 $ hg bookmark r3
99
100
100 $ hg split 'all()'
101 $ hg split 'all()'
101 abort: cannot split multiple revisions
102 abort: cannot split multiple revisions
102 [255]
103 [255]
103
104
104 $ runsplit() {
105 $ runsplit() {
105 > cat > $TESTTMP/messages <<EOF
106 > cat > $TESTTMP/messages <<EOF
106 > split 1
107 > split 1
107 > --
108 > --
108 > split 2
109 > split 2
109 > --
110 > --
110 > split 3
111 > split 3
111 > EOF
112 > EOF
112 > cat <<EOF | hg split "$@"
113 > cat <<EOF | hg split "$@"
113 > y
114 > y
114 > y
115 > y
115 > y
116 > y
116 > y
117 > y
117 > y
118 > y
118 > y
119 > y
119 > EOF
120 > EOF
120 > }
121 > }
121
122
122 $ HGEDITOR=false runsplit
123 $ HGEDITOR=false runsplit
123 diff --git a/a b/a
124 diff --git a/a b/a
124 1 hunks, 1 lines changed
125 1 hunks, 1 lines changed
125 examine changes to 'a'? [Ynesfdaq?] y
126 examine changes to 'a'? [Ynesfdaq?] y
126
127
127 @@ -5,1 +5,1 @@ 4
128 @@ -5,1 +5,1 @@ 4
128 -5
129 -5
129 +55
130 +55
130 record this change to 'a'? [Ynesfdaq?] y
131 record this change to 'a'? [Ynesfdaq?] y
131
132
132 transaction abort!
133 transaction abort!
133 rollback completed
134 rollback completed
134 abort: edit failed: false exited with status 1
135 abort: edit failed: false exited with status 1
135 [255]
136 [255]
136 $ hg status
137 $ hg status
137
138
138 $ HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py"
139 $ HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py"
139 $ runsplit
140 $ runsplit
140 diff --git a/a b/a
141 diff --git a/a b/a
141 1 hunks, 1 lines changed
142 1 hunks, 1 lines changed
142 examine changes to 'a'? [Ynesfdaq?] y
143 examine changes to 'a'? [Ynesfdaq?] y
143
144
144 @@ -5,1 +5,1 @@ 4
145 @@ -5,1 +5,1 @@ 4
145 -5
146 -5
146 +55
147 +55
147 record this change to 'a'? [Ynesfdaq?] y
148 record this change to 'a'? [Ynesfdaq?] y
148
149
149 EDITOR: HG: Splitting 1df0d5c5a3ab. Write commit message for the first split changeset.
150 EDITOR: HG: Splitting 1df0d5c5a3ab. Write commit message for the first split changeset.
150 EDITOR: a2
151 EDITOR: a2
151 EDITOR:
152 EDITOR:
152 EDITOR:
153 EDITOR:
153 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
154 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
154 EDITOR: HG: Leave message empty to abort commit.
155 EDITOR: HG: Leave message empty to abort commit.
155 EDITOR: HG: --
156 EDITOR: HG: --
156 EDITOR: HG: user: test
157 EDITOR: HG: user: test
157 EDITOR: HG: branch 'default'
158 EDITOR: HG: branch 'default'
158 EDITOR: HG: changed a
159 EDITOR: HG: changed a
159 created new head
160 created new head
160 diff --git a/a b/a
161 diff --git a/a b/a
161 1 hunks, 1 lines changed
162 1 hunks, 1 lines changed
162 examine changes to 'a'? [Ynesfdaq?] y
163 examine changes to 'a'? [Ynesfdaq?] y
163
164
164 @@ -3,1 +3,1 @@ 2
165 @@ -3,1 +3,1 @@ 2
165 -3
166 -3
166 +33
167 +33
167 record this change to 'a'? [Ynesfdaq?] y
168 record this change to 'a'? [Ynesfdaq?] y
168
169
169 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into:
170 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into:
170 EDITOR: HG: - e704349bd21b: split 1
171 EDITOR: HG: - e704349bd21b: split 1
171 EDITOR: HG: Write commit message for the next split changeset.
172 EDITOR: HG: Write commit message for the next split changeset.
172 EDITOR: a2
173 EDITOR: a2
173 EDITOR:
174 EDITOR:
174 EDITOR:
175 EDITOR:
175 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
176 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
176 EDITOR: HG: Leave message empty to abort commit.
177 EDITOR: HG: Leave message empty to abort commit.
177 EDITOR: HG: --
178 EDITOR: HG: --
178 EDITOR: HG: user: test
179 EDITOR: HG: user: test
179 EDITOR: HG: branch 'default'
180 EDITOR: HG: branch 'default'
180 EDITOR: HG: changed a
181 EDITOR: HG: changed a
181 diff --git a/a b/a
182 diff --git a/a b/a
182 1 hunks, 1 lines changed
183 1 hunks, 1 lines changed
183 examine changes to 'a'? [Ynesfdaq?] y
184 examine changes to 'a'? [Ynesfdaq?] y
184
185
185 @@ -1,1 +1,1 @@
186 @@ -1,1 +1,1 @@
186 -1
187 -1
187 +11
188 +11
188 record this change to 'a'? [Ynesfdaq?] y
189 record this change to 'a'? [Ynesfdaq?] y
189
190
190 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into:
191 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into:
191 EDITOR: HG: - e704349bd21b: split 1
192 EDITOR: HG: - e704349bd21b: split 1
192 EDITOR: HG: - a09ad58faae3: split 2
193 EDITOR: HG: - a09ad58faae3: split 2
193 EDITOR: HG: Write commit message for the next split changeset.
194 EDITOR: HG: Write commit message for the next split changeset.
194 EDITOR: a2
195 EDITOR: a2
195 EDITOR:
196 EDITOR:
196 EDITOR:
197 EDITOR:
197 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
198 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
198 EDITOR: HG: Leave message empty to abort commit.
199 EDITOR: HG: Leave message empty to abort commit.
199 EDITOR: HG: --
200 EDITOR: HG: --
200 EDITOR: HG: user: test
201 EDITOR: HG: user: test
201 EDITOR: HG: branch 'default'
202 EDITOR: HG: branch 'default'
202 EDITOR: HG: changed a
203 EDITOR: HG: changed a
203 saved backup bundle to $TESTTMP/a/.hg/strip-backup/1df0d5c5a3ab-8341b760-split.hg (obsstore-off !)
204 saved backup bundle to $TESTTMP/a/.hg/strip-backup/1df0d5c5a3ab-8341b760-split.hg (obsstore-off !)
204
205
205 #if obsstore-off
206 #if obsstore-off
206 $ hg bookmark
207 $ hg bookmark
207 r1 0:a61bcde8c529
208 r1 0:a61bcde8c529
208 r2 3:00eebaf8d2e2
209 r2 3:00eebaf8d2e2
209 * r3 3:00eebaf8d2e2
210 * r3 3:00eebaf8d2e2
210 $ hg glog -p
211 $ hg glog -p
211 @ 3:00eebaf8d2e2 split 3 r2 r3
212 @ 3:00eebaf8d2e2 split 3 r2 r3
212 | diff --git a/a b/a
213 | diff --git a/a b/a
213 | --- a/a
214 | --- a/a
214 | +++ b/a
215 | +++ b/a
215 | @@ -1,1 +1,1 @@
216 | @@ -1,1 +1,1 @@
216 | -1
217 | -1
217 | +11
218 | +11
218 |
219 |
219 o 2:a09ad58faae3 split 2
220 o 2:a09ad58faae3 split 2
220 | diff --git a/a b/a
221 | diff --git a/a b/a
221 | --- a/a
222 | --- a/a
222 | +++ b/a
223 | +++ b/a
223 | @@ -3,1 +3,1 @@
224 | @@ -3,1 +3,1 @@
224 | -3
225 | -3
225 | +33
226 | +33
226 |
227 |
227 o 1:e704349bd21b split 1
228 o 1:e704349bd21b split 1
228 | diff --git a/a b/a
229 | diff --git a/a b/a
229 | --- a/a
230 | --- a/a
230 | +++ b/a
231 | +++ b/a
231 | @@ -5,1 +5,1 @@
232 | @@ -5,1 +5,1 @@
232 | -5
233 | -5
233 | +55
234 | +55
234 |
235 |
235 o 0:a61bcde8c529 a1 r1
236 o 0:a61bcde8c529 a1 r1
236 diff --git a/a b/a
237 diff --git a/a b/a
237 new file mode 100644
238 new file mode 100644
238 --- /dev/null
239 --- /dev/null
239 +++ b/a
240 +++ b/a
240 @@ -0,0 +1,5 @@
241 @@ -0,0 +1,5 @@
241 +1
242 +1
242 +2
243 +2
243 +3
244 +3
244 +4
245 +4
245 +5
246 +5
246
247
247 #else
248 #else
248 $ hg bookmark
249 $ hg bookmark
249 r1 0:a61bcde8c529
250 r1 0:a61bcde8c529
250 r2 4:00eebaf8d2e2
251 r2 4:00eebaf8d2e2
251 * r3 4:00eebaf8d2e2
252 * r3 4:00eebaf8d2e2
252 $ hg glog
253 $ hg glog
253 @ 4:00eebaf8d2e2 split 3 r2 r3
254 @ 4:00eebaf8d2e2 split 3 r2 r3
254 |
255 |
255 o 3:a09ad58faae3 split 2
256 o 3:a09ad58faae3 split 2
256 |
257 |
257 o 2:e704349bd21b split 1
258 o 2:e704349bd21b split 1
258 |
259 |
259 o 0:a61bcde8c529 a1 r1
260 o 0:a61bcde8c529 a1 r1
260
261
261 #endif
262 #endif
262
263
263 Split a head while working parent is not that head
264 Split a head while working parent is not that head
264
265
265 $ cd $TESTTMP/b
266 $ cd $TESTTMP/b
266
267
267 $ hg up 0 -q
268 $ hg up 0 -q
268 $ hg bookmark r3
269 $ hg bookmark r3
269
270
270 $ runsplit tip >/dev/null
271 $ runsplit tip >/dev/null
271
272
272 #if obsstore-off
273 #if obsstore-off
273 $ hg bookmark
274 $ hg bookmark
274 r1 0:a61bcde8c529
275 r1 0:a61bcde8c529
275 r2 3:00eebaf8d2e2
276 r2 3:00eebaf8d2e2
276 * r3 0:a61bcde8c529
277 * r3 0:a61bcde8c529
277 $ hg glog
278 $ hg glog
278 o 3:00eebaf8d2e2 split 3 r2
279 o 3:00eebaf8d2e2 split 3 r2
279 |
280 |
280 o 2:a09ad58faae3 split 2
281 o 2:a09ad58faae3 split 2
281 |
282 |
282 o 1:e704349bd21b split 1
283 o 1:e704349bd21b split 1
283 |
284 |
284 @ 0:a61bcde8c529 a1 r1 r3
285 @ 0:a61bcde8c529 a1 r1 r3
285
286
286 #else
287 #else
287 $ hg bookmark
288 $ hg bookmark
288 r1 0:a61bcde8c529
289 r1 0:a61bcde8c529
289 r2 4:00eebaf8d2e2
290 r2 4:00eebaf8d2e2
290 * r3 0:a61bcde8c529
291 * r3 0:a61bcde8c529
291 $ hg glog
292 $ hg glog
292 o 4:00eebaf8d2e2 split 3 r2
293 o 4:00eebaf8d2e2 split 3 r2
293 |
294 |
294 o 3:a09ad58faae3 split 2
295 o 3:a09ad58faae3 split 2
295 |
296 |
296 o 2:e704349bd21b split 1
297 o 2:e704349bd21b split 1
297 |
298 |
298 @ 0:a61bcde8c529 a1 r1 r3
299 @ 0:a61bcde8c529 a1 r1 r3
299
300
300 #endif
301 #endif
301
302
302 Split a non-head
303 Split a non-head
303
304
304 $ cd $TESTTMP/c
305 $ cd $TESTTMP/c
305 $ echo d > d
306 $ echo d > d
306 $ hg ci -m d1 -A d
307 $ hg ci -m d1 -A d
307 $ hg bookmark -i d1
308 $ hg bookmark -i d1
308 $ echo 2 >> d
309 $ echo 2 >> d
309 $ hg ci -m d2
310 $ hg ci -m d2
310 $ echo 3 >> d
311 $ echo 3 >> d
311 $ hg ci -m d3
312 $ hg ci -m d3
312 $ hg bookmark -i d3
313 $ hg bookmark -i d3
313 $ hg up '.^' -q
314 $ hg up '.^' -q
314 $ hg bookmark d2
315 $ hg bookmark d2
315 $ cp -R . ../d
316 $ cp -R . ../d
316
317
317 $ runsplit -r 1 | grep rebasing
318 $ runsplit -r 1 | grep rebasing
318 rebasing 2:b5c5ea414030 "d1" (d1)
319 rebasing 2:b5c5ea414030 "d1" (d1)
319 rebasing 3:f4a0a8d004cc "d2" (d2)
320 rebasing 3:f4a0a8d004cc "d2" (d2)
320 rebasing 4:777940761eba "d3" (d3)
321 rebasing 4:777940761eba "d3" (d3)
321 #if obsstore-off
322 #if obsstore-off
322 $ hg bookmark
323 $ hg bookmark
323 d1 4:c4b449ef030e
324 d1 4:c4b449ef030e
324 * d2 5:c9dd00ab36a3
325 * d2 5:c9dd00ab36a3
325 d3 6:19f476bc865c
326 d3 6:19f476bc865c
326 r1 0:a61bcde8c529
327 r1 0:a61bcde8c529
327 r2 3:00eebaf8d2e2
328 r2 3:00eebaf8d2e2
328 $ hg glog -p
329 $ hg glog -p
329 o 6:19f476bc865c d3 d3
330 o 6:19f476bc865c d3 d3
330 | diff --git a/d b/d
331 | diff --git a/d b/d
331 | --- a/d
332 | --- a/d
332 | +++ b/d
333 | +++ b/d
333 | @@ -2,0 +3,1 @@
334 | @@ -2,0 +3,1 @@
334 | +3
335 | +3
335 |
336 |
336 @ 5:c9dd00ab36a3 d2 d2
337 @ 5:c9dd00ab36a3 d2 d2
337 | diff --git a/d b/d
338 | diff --git a/d b/d
338 | --- a/d
339 | --- a/d
339 | +++ b/d
340 | +++ b/d
340 | @@ -1,0 +2,1 @@
341 | @@ -1,0 +2,1 @@
341 | +2
342 | +2
342 |
343 |
343 o 4:c4b449ef030e d1 d1
344 o 4:c4b449ef030e d1 d1
344 | diff --git a/d b/d
345 | diff --git a/d b/d
345 | new file mode 100644
346 | new file mode 100644
346 | --- /dev/null
347 | --- /dev/null
347 | +++ b/d
348 | +++ b/d
348 | @@ -0,0 +1,1 @@
349 | @@ -0,0 +1,1 @@
349 | +d
350 | +d
350 |
351 |
351 o 3:00eebaf8d2e2 split 3 r2
352 o 3:00eebaf8d2e2 split 3 r2
352 | diff --git a/a b/a
353 | diff --git a/a b/a
353 | --- a/a
354 | --- a/a
354 | +++ b/a
355 | +++ b/a
355 | @@ -1,1 +1,1 @@
356 | @@ -1,1 +1,1 @@
356 | -1
357 | -1
357 | +11
358 | +11
358 |
359 |
359 o 2:a09ad58faae3 split 2
360 o 2:a09ad58faae3 split 2
360 | diff --git a/a b/a
361 | diff --git a/a b/a
361 | --- a/a
362 | --- a/a
362 | +++ b/a
363 | +++ b/a
363 | @@ -3,1 +3,1 @@
364 | @@ -3,1 +3,1 @@
364 | -3
365 | -3
365 | +33
366 | +33
366 |
367 |
367 o 1:e704349bd21b split 1
368 o 1:e704349bd21b split 1
368 | diff --git a/a b/a
369 | diff --git a/a b/a
369 | --- a/a
370 | --- a/a
370 | +++ b/a
371 | +++ b/a
371 | @@ -5,1 +5,1 @@
372 | @@ -5,1 +5,1 @@
372 | -5
373 | -5
373 | +55
374 | +55
374 |
375 |
375 o 0:a61bcde8c529 a1 r1
376 o 0:a61bcde8c529 a1 r1
376 diff --git a/a b/a
377 diff --git a/a b/a
377 new file mode 100644
378 new file mode 100644
378 --- /dev/null
379 --- /dev/null
379 +++ b/a
380 +++ b/a
380 @@ -0,0 +1,5 @@
381 @@ -0,0 +1,5 @@
381 +1
382 +1
382 +2
383 +2
383 +3
384 +3
384 +4
385 +4
385 +5
386 +5
386
387
387 #else
388 #else
388 $ hg bookmark
389 $ hg bookmark
389 d1 8:c4b449ef030e
390 d1 8:c4b449ef030e
390 * d2 9:c9dd00ab36a3
391 * d2 9:c9dd00ab36a3
391 d3 10:19f476bc865c
392 d3 10:19f476bc865c
392 r1 0:a61bcde8c529
393 r1 0:a61bcde8c529
393 r2 7:00eebaf8d2e2
394 r2 7:00eebaf8d2e2
394 $ hg glog
395 $ hg glog
395 o 10:19f476bc865c d3 d3
396 o 10:19f476bc865c d3 d3
396 |
397 |
397 @ 9:c9dd00ab36a3 d2 d2
398 @ 9:c9dd00ab36a3 d2 d2
398 |
399 |
399 o 8:c4b449ef030e d1 d1
400 o 8:c4b449ef030e d1 d1
400 |
401 |
401 o 7:00eebaf8d2e2 split 3 r2
402 o 7:00eebaf8d2e2 split 3 r2
402 |
403 |
403 o 6:a09ad58faae3 split 2
404 o 6:a09ad58faae3 split 2
404 |
405 |
405 o 5:e704349bd21b split 1
406 o 5:e704349bd21b split 1
406 |
407 |
407 o 0:a61bcde8c529 a1 r1
408 o 0:a61bcde8c529 a1 r1
408
409
409 #endif
410 #endif
410
411
411 Split a non-head without rebase
412 Split a non-head without rebase
412
413
413 $ cd $TESTTMP/d
414 $ cd $TESTTMP/d
414 #if obsstore-off
415 #if obsstore-off
415 $ runsplit -r 1 --no-rebase
416 $ runsplit -r 1 --no-rebase
416 abort: cannot split changeset with children without rebase
417 abort: cannot split changeset with children without rebase
417 [255]
418 [255]
418 #else
419 #else
419 $ runsplit -r 1 --no-rebase >/dev/null
420 $ runsplit -r 1 --no-rebase >/dev/null
420 3 new orphan changesets
421 3 new orphan changesets
421 $ hg bookmark
422 $ hg bookmark
422 d1 2:b5c5ea414030
423 d1 2:b5c5ea414030
423 * d2 3:f4a0a8d004cc
424 * d2 3:f4a0a8d004cc
424 d3 4:777940761eba
425 d3 4:777940761eba
425 r1 0:a61bcde8c529
426 r1 0:a61bcde8c529
426 r2 7:00eebaf8d2e2
427 r2 7:00eebaf8d2e2
427
428
428 $ hg glog
429 $ hg glog
429 o 7:00eebaf8d2e2 split 3 r2
430 o 7:00eebaf8d2e2 split 3 r2
430 |
431 |
431 o 6:a09ad58faae3 split 2
432 o 6:a09ad58faae3 split 2
432 |
433 |
433 o 5:e704349bd21b split 1
434 o 5:e704349bd21b split 1
434 |
435 |
435 | * 4:777940761eba d3 d3
436 | * 4:777940761eba d3 d3
436 | |
437 | |
437 | @ 3:f4a0a8d004cc d2 d2
438 | @ 3:f4a0a8d004cc d2 d2
438 | |
439 | |
439 | * 2:b5c5ea414030 d1 d1
440 | * 2:b5c5ea414030 d1 d1
440 | |
441 | |
441 | x 1:1df0d5c5a3ab a2
442 | x 1:1df0d5c5a3ab a2
442 |/
443 |/
443 o 0:a61bcde8c529 a1 r1
444 o 0:a61bcde8c529 a1 r1
444
445
445 #endif
446 #endif
446
447
447 Split a non-head with obsoleted descendants
448 Split a non-head with obsoleted descendants
448
449
449 #if obsstore-on
450 #if obsstore-on
450 $ hg init $TESTTMP/e
451 $ hg init $TESTTMP/e
451 $ cd $TESTTMP/e
452 $ cd $TESTTMP/e
452 $ hg debugdrawdag <<'EOS'
453 $ hg debugdrawdag <<'EOS'
453 > H I J
454 > H I J
454 > | | |
455 > | | |
455 > F G1 G2 # amend: G1 -> G2
456 > F G1 G2 # amend: G1 -> G2
456 > | | / # prune: F
457 > | | / # prune: F
457 > C D E
458 > C D E
458 > \|/
459 > \|/
459 > B
460 > B
460 > |
461 > |
461 > A
462 > A
462 > EOS
463 > EOS
463 2 new orphan changesets
464 2 new orphan changesets
464 $ eval `hg tags -T '{tag}={node}\n'`
465 $ eval `hg tags -T '{tag}={node}\n'`
465 $ rm .hg/localtags
466 $ rm .hg/localtags
466 $ hg split $B --config experimental.evolution=createmarkers
467 $ hg split $B --config experimental.evolution=createmarkers
467 abort: split would leave orphaned changesets behind
468 abort: split would leave orphaned changesets behind
468 [255]
469 [255]
469 $ cat > $TESTTMP/messages <<EOF
470 $ cat > $TESTTMP/messages <<EOF
470 > Split B
471 > Split B
471 > EOF
472 > EOF
472 $ cat <<EOF | hg split $B
473 $ cat <<EOF | hg split $B
473 > y
474 > y
474 > y
475 > y
475 > EOF
476 > EOF
476 diff --git a/B b/B
477 diff --git a/B b/B
477 new file mode 100644
478 new file mode 100644
478 examine changes to 'B'? [Ynesfdaq?] y
479 examine changes to 'B'? [Ynesfdaq?] y
479
480
480 @@ -0,0 +1,1 @@
481 @@ -0,0 +1,1 @@
481 +B
482 +B
482 \ No newline at end of file
483 \ No newline at end of file
483 record this change to 'B'? [Ynesfdaq?] y
484 record this change to 'B'? [Ynesfdaq?] y
484
485
485 EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset.
486 EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset.
486 EDITOR: B
487 EDITOR: B
487 EDITOR:
488 EDITOR:
488 EDITOR:
489 EDITOR:
489 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
490 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
490 EDITOR: HG: Leave message empty to abort commit.
491 EDITOR: HG: Leave message empty to abort commit.
491 EDITOR: HG: --
492 EDITOR: HG: --
492 EDITOR: HG: user: test
493 EDITOR: HG: user: test
493 EDITOR: HG: branch 'default'
494 EDITOR: HG: branch 'default'
494 EDITOR: HG: added B
495 EDITOR: HG: added B
495 created new head
496 created new head
496 rebasing 2:26805aba1e60 "C"
497 rebasing 2:26805aba1e60 "C"
497 rebasing 3:be0ef73c17ad "D"
498 rebasing 3:be0ef73c17ad "D"
498 rebasing 4:49cb92066bfd "E"
499 rebasing 4:49cb92066bfd "E"
499 rebasing 7:97a6268cc7ef "G2"
500 rebasing 7:97a6268cc7ef "G2"
500 rebasing 10:e2f1e425c0db "J"
501 rebasing 10:e2f1e425c0db "J"
501 $ hg glog -r 'sort(all(), topo)'
502 $ hg glog -r 'sort(all(), topo)'
502 o 16:556c085f8b52 J
503 o 16:556c085f8b52 J
503 |
504 |
504 o 15:8761f6c9123f G2
505 o 15:8761f6c9123f G2
505 |
506 |
506 o 14:a7aeffe59b65 E
507 o 14:a7aeffe59b65 E
507 |
508 |
508 | o 13:e1e914ede9ab D
509 | o 13:e1e914ede9ab D
509 |/
510 |/
510 | o 12:01947e9b98aa C
511 | o 12:01947e9b98aa C
511 |/
512 |/
512 o 11:0947baa74d47 Split B
513 o 11:0947baa74d47 Split B
513 |
514 |
514 | * 9:88ede1d5ee13 I
515 | * 9:88ede1d5ee13 I
515 | |
516 | |
516 | x 6:af8cbf225b7b G1
517 | x 6:af8cbf225b7b G1
517 | |
518 | |
518 | x 3:be0ef73c17ad D
519 | x 3:be0ef73c17ad D
519 | |
520 | |
520 | | * 8:74863e5b5074 H
521 | | * 8:74863e5b5074 H
521 | | |
522 | | |
522 | | x 5:ee481a2a1e69 F
523 | | x 5:ee481a2a1e69 F
523 | | |
524 | | |
524 | | x 2:26805aba1e60 C
525 | | x 2:26805aba1e60 C
525 | |/
526 | |/
526 | x 1:112478962961 B
527 | x 1:112478962961 B
527 |/
528 |/
528 o 0:426bada5c675 A
529 o 0:426bada5c675 A
529
530
530 #endif
531 #endif
General Comments 0
You need to be logged in to leave comments. Login now