summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/daemon.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 9522153d..22a8c3b7 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -3590,6 +3590,24 @@ def upgrades(old, new):
text = int(client.read('/look'))
client.write(f'/pane/{text}/body', b'unsaved\n')
assert client.read(f'/pane/{text}/body') == b'one\ntwo\nunsaved\n'
+ # A file of a jj repository with its `Changes` layer shown (a build
+ # of wire 31: ghost rows, a view's bit; wire 34: the pane's read-only
+ # lines): shown again after the Upgrade.
+ layered = None
+ if shutil.which('jj'):
+ repo = root / 'repo'
+ repo.mkdir()
+ jj = ['jj', '--config=user.name=t', '--config=user.email=t@t', '--quiet']
+ subprocess.run(jj + ['git', 'init'], cwd=repo, env=env, check=True, capture_output=True)
+ (repo / 'l.txt').write_text('kept-one\ngone-line-xyzzy\nkept-two\n')
+ subprocess.run(jj + ['commit', '-m', 'one'], cwd=repo, env=env, check=True, capture_output=True)
+ (repo / 'l.txt').write_text('kept-one\nkept-two\n')
+ # Committed: pardes never snapshots the working copy.
+ subprocess.run(jj + ['commit', '-m', 'two'], cwd=repo, env=env, check=True, capture_output=True)
+ client.write(f'/pane/{shell}/look', f'{repo / "l.txt"}\n'.encode())
+ layered = int(client.read('/look'))
+ client.write(f'/pane/{layered}/exec', b'Changes @-\n')
+ wait_for('the layer drawn', lambda: 'gone-line-xyzzy' in screen_text(client), timeout=30)
client.write(f'/pane/{shell}/pty/data', b'sleep 1000; echo done-after-upgrade\r')
sleeper = wait_for('the sleep', lambda: [p for p in processes(root) if cmdline(p)[:2] == [b'sleep', b'1000']])[0]
# A second terminal: a view of its own (an older build's), or a client.
@@ -3676,6 +3694,12 @@ def upgrades(old, new):
assert any(row.split()[0] == str(text).encode() and row.split()[2] == b'1' for row in client.read('/index').splitlines()), client.read('/index')
client.write(f'/pane/{text}/exec', b'Undo\n')
assert client.read(f'/pane/{text}/body') == b'one\ntwo\n', client.read(f'/pane/{text}/body')
+ # The layer shown before it: shown, its line drawn, the file's text
+ # (9P's body) without it.
+ if layered is not None:
+ assert client.read(f'/pane/{layered}/body') == b'kept-one\nkept-two\n', client.read(f'/pane/{layered}/body')
+ wait_for('the layer drawn again', lambda: 'gone-line-xyzzy' in screen_text(client), timeout=30)
+ print('upgrade: a file\'s Changes layer shown on the old build shown on the new, its line drawn, 9P\'s body the file\'s text without it')
# The shell, its job and its pty: the same, the session's still.
assert alive(shell_pid) and ppid(shell_pid) == session and alive(sleeper)
# Both terminals drawn again, each its own view.