annotate tests/test-status-inprocess.py @ 38679:b3d0c97a0820

rebase: in --confirm option just abort if hit a conflict Before this patch, it was prompting the user in both cases 1) when there is no conflict 2) when there is at least one conflict. But for simplicity we can just abort if we hit a conflict and no need to prompt in that case. Differential Revision: https://phab.mercurial-scm.org/D3944
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 14 Jul 2018 08:59:42 +0530
parents bbff7170f665
children 7ce9dea3a14a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28824
9d31582dd636 tests: use /usr/bin/env python for test-status-inprocess.py
timeless <timeless@mozdev.org>
parents: 28766
diff changeset
1 #!/usr/bin/env python
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
2 from __future__ import absolute_import, print_function
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
3
37901
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
4 import sys
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
5
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
6 from mercurial import (
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
7 commands,
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
8 localrepo,
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
9 ui as uimod,
28765
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
10 )
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
11
37901
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
12 print_ = print
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
13 def print(*args, **kwargs):
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
14 """print() wrapper that flushes stdout buffers to avoid py3 buffer issues
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
15
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
16 We could also just write directly to sys.stdout.buffer the way the
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
17 ui object will, but this was easier for porting the test.
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
18 """
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
19 print_(*args, **kwargs)
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
20 sys.stdout.flush()
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
21
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28843
diff changeset
22 u = uimod.ui.load()
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
23
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
24 print('% creating repo')
37660
9dfa4e9ed45d py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30559
diff changeset
25 repo = localrepo.localrepository(u, b'.', create=True)
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
26
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
27 f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
28 try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
29 f.write('foo\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
30 finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
31 f.close
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
32
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
33 print('% add and commit')
37660
9dfa4e9ed45d py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30559
diff changeset
34 commands.add(u, repo, b'test.py')
9dfa4e9ed45d py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30559
diff changeset
35 commands.commit(u, repo, message=b'*')
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
36 commands.status(u, repo, clean=True)
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
37
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
38
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
39 print('% change')
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
40 f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
41 try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
42 f.write('bar\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
43 finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
44 f.close()
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
45
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
46 # this would return clean instead of changed before the fix
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
47 commands.status(u, repo, clean=True, modified=True)