##// END OF EJS Templates
fix traceback of extdiff after a merge...
Benoit Boissinot -
r3330:49966b5a default
parent child Browse files
Show More
@@ -1,184 +1,187
1 # extdiff.py - external diff program support for mercurial
1 # extdiff.py - external diff program support for mercurial
2 #
2 #
3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
4 #
4 #
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7 #
7 #
8 # The `extdiff' Mercurial extension allows you to use external programs
8 # The `extdiff' Mercurial extension allows you to use external programs
9 # to compare revisions, or revision with working dir. The external diff
9 # to compare revisions, or revision with working dir. The external diff
10 # programs are called with a configurable set of options and two
10 # programs are called with a configurable set of options and two
11 # non-option arguments: paths to directories containing snapshots of
11 # non-option arguments: paths to directories containing snapshots of
12 # files to compare.
12 # files to compare.
13 #
13 #
14 # To enable this extension:
14 # To enable this extension:
15 #
15 #
16 # [extensions]
16 # [extensions]
17 # hgext.extdiff =
17 # hgext.extdiff =
18 #
18 #
19 # The `extdiff' extension also allows to configure new diff commands, so
19 # The `extdiff' extension also allows to configure new diff commands, so
20 # you do not need to type "hg extdiff -p kdiff3" always.
20 # you do not need to type "hg extdiff -p kdiff3" always.
21 #
21 #
22 # [extdiff]
22 # [extdiff]
23 # # add new command that runs GNU diff(1) in 'context diff' mode
23 # # add new command that runs GNU diff(1) in 'context diff' mode
24 # cmd.cdiff = gdiff
24 # cmd.cdiff = gdiff
25 # opts.cdiff = -Nprc5
25 # opts.cdiff = -Nprc5
26
26
27 # # add new command called vdiff, runs kdiff3
27 # # add new command called vdiff, runs kdiff3
28 # cmd.vdiff = kdiff3
28 # cmd.vdiff = kdiff3
29
29
30 # # add new command called meld, runs meld (no need to name twice)
30 # # add new command called meld, runs meld (no need to name twice)
31 # cmd.meld =
31 # cmd.meld =
32
32
33 # # add new command called vimdiff, runs gvimdiff with DirDiff plugin
33 # # add new command called vimdiff, runs gvimdiff with DirDiff plugin
34 # #(see http://www.vim.org/scripts/script.php?script_id=102)
34 # #(see http://www.vim.org/scripts/script.php?script_id=102)
35 # # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
35 # # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
36 # # your .vimrc
36 # # your .vimrc
37 # cmd.vimdiff = gvim
37 # cmd.vimdiff = gvim
38 # opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
38 # opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
39 #
39 #
40 # Each custom diff commands can have two parts: a `cmd' and an `opts'
40 # Each custom diff commands can have two parts: a `cmd' and an `opts'
41 # part. The cmd.xxx option defines the name of an executable program
41 # part. The cmd.xxx option defines the name of an executable program
42 # that will be run, and opts.xxx defines a set of command-line options
42 # that will be run, and opts.xxx defines a set of command-line options
43 # which will be inserted to the command between the program name and
43 # which will be inserted to the command between the program name and
44 # the files/directories to diff (i.e. the cdiff example above).
44 # the files/directories to diff (i.e. the cdiff example above).
45 #
45 #
46 # You can use -I/-X and list of file or directory names like normal
46 # You can use -I/-X and list of file or directory names like normal
47 # "hg diff" command. The `extdiff' extension makes snapshots of only
47 # "hg diff" command. The `extdiff' extension makes snapshots of only
48 # needed files, so running the external diff program will actually be
48 # needed files, so running the external diff program will actually be
49 # pretty fast (at least faster than having to compare the entire tree).
49 # pretty fast (at least faster than having to compare the entire tree).
50
50
51 from mercurial.demandload import demandload
51 from mercurial.demandload import demandload
52 from mercurial.i18n import gettext as _
52 from mercurial.i18n import gettext as _
53 from mercurial.node import *
53 from mercurial.node import *
54 demandload(globals(), 'mercurial:cmdutil,util os shutil tempfile')
54 demandload(globals(), 'mercurial:cmdutil,util os shutil tempfile')
55
55
56 def dodiff(ui, repo, diffcmd, diffopts, pats, opts):
56 def dodiff(ui, repo, diffcmd, diffopts, pats, opts):
57 def snapshot_node(files, node):
57 def snapshot_node(files, node):
58 '''snapshot files as of some revision'''
58 '''snapshot files as of some revision'''
59 changes = repo.changelog.read(node)
59 changes = repo.changelog.read(node)
60 mf = repo.manifest.read(changes[0])
60 mf = repo.manifest.read(changes[0])
61 dirname = '%s.%s' % (os.path.basename(repo.root), short(node))
61 dirname = '%s.%s' % (os.path.basename(repo.root), short(node))
62 base = os.path.join(tmproot, dirname)
62 base = os.path.join(tmproot, dirname)
63 os.mkdir(base)
63 os.mkdir(base)
64 if not ui.quiet:
64 if not ui.quiet:
65 ui.write_err(_('making snapshot of %d files from rev %s\n') %
65 ui.write_err(_('making snapshot of %d files from rev %s\n') %
66 (len(files), short(node)))
66 (len(files), short(node)))
67 for fn in files:
67 for fn in files:
68 if not fn in mf:
69 # skipping new file after a merge ?
70 continue
68 wfn = util.pconvert(fn)
71 wfn = util.pconvert(fn)
69 ui.note(' %s\n' % wfn)
72 ui.note(' %s\n' % wfn)
70 dest = os.path.join(base, wfn)
73 dest = os.path.join(base, wfn)
71 destdir = os.path.dirname(dest)
74 destdir = os.path.dirname(dest)
72 if not os.path.isdir(destdir):
75 if not os.path.isdir(destdir):
73 os.makedirs(destdir)
76 os.makedirs(destdir)
74 repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'w'))
77 repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'w'))
75 return dirname
78 return dirname
76
79
77 def snapshot_wdir(files):
80 def snapshot_wdir(files):
78 '''snapshot files from working directory.
81 '''snapshot files from working directory.
79 if not using snapshot, -I/-X does not work and recursive diff
82 if not using snapshot, -I/-X does not work and recursive diff
80 in tools like kdiff3 and meld displays too many files.'''
83 in tools like kdiff3 and meld displays too many files.'''
81 dirname = os.path.basename(repo.root)
84 dirname = os.path.basename(repo.root)
82 base = os.path.join(tmproot, dirname)
85 base = os.path.join(tmproot, dirname)
83 os.mkdir(base)
86 os.mkdir(base)
84 if not ui.quiet:
87 if not ui.quiet:
85 ui.write_err(_('making snapshot of %d files from working dir\n') %
88 ui.write_err(_('making snapshot of %d files from working dir\n') %
86 (len(files)))
89 (len(files)))
87 for fn in files:
90 for fn in files:
88 wfn = util.pconvert(fn)
91 wfn = util.pconvert(fn)
89 ui.note(' %s\n' % wfn)
92 ui.note(' %s\n' % wfn)
90 dest = os.path.join(base, wfn)
93 dest = os.path.join(base, wfn)
91 destdir = os.path.dirname(dest)
94 destdir = os.path.dirname(dest)
92 if not os.path.isdir(destdir):
95 if not os.path.isdir(destdir):
93 os.makedirs(destdir)
96 os.makedirs(destdir)
94 fp = open(dest, 'w')
97 fp = open(dest, 'w')
95 for chunk in util.filechunkiter(repo.wopener(wfn)):
98 for chunk in util.filechunkiter(repo.wopener(wfn)):
96 fp.write(chunk)
99 fp.write(chunk)
97 return dirname
100 return dirname
98
101
99 node1, node2 = cmdutil.revpair(ui, repo, opts['rev'])
102 node1, node2 = cmdutil.revpair(ui, repo, opts['rev'])
100 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
103 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
101 modified, added, removed, deleted, unknown = repo.status(
104 modified, added, removed, deleted, unknown = repo.status(
102 node1, node2, files, match=matchfn)[:5]
105 node1, node2, files, match=matchfn)[:5]
103 if not (modified or added or removed):
106 if not (modified or added or removed):
104 return 0
107 return 0
105
108
106 tmproot = tempfile.mkdtemp(prefix='extdiff.')
109 tmproot = tempfile.mkdtemp(prefix='extdiff.')
107 try:
110 try:
108 dir1 = snapshot_node(modified + removed, node1)
111 dir1 = snapshot_node(modified + removed, node1)
109 if node2:
112 if node2:
110 dir2 = snapshot_node(modified + added, node2)
113 dir2 = snapshot_node(modified + added, node2)
111 else:
114 else:
112 dir2 = snapshot_wdir(modified + added)
115 dir2 = snapshot_wdir(modified + added)
113 cmdline = ('%s %s %s %s' %
116 cmdline = ('%s %s %s %s' %
114 (util.shellquote(diffcmd), ' '.join(diffopts),
117 (util.shellquote(diffcmd), ' '.join(diffopts),
115 util.shellquote(dir1), util.shellquote(dir2)))
118 util.shellquote(dir1), util.shellquote(dir2)))
116 ui.debug('running %r in %s\n' % (cmdline, tmproot))
119 ui.debug('running %r in %s\n' % (cmdline, tmproot))
117 util.system(cmdline, cwd=tmproot)
120 util.system(cmdline, cwd=tmproot)
118 return 1
121 return 1
119 finally:
122 finally:
120 ui.note(_('cleaning up temp directory\n'))
123 ui.note(_('cleaning up temp directory\n'))
121 shutil.rmtree(tmproot)
124 shutil.rmtree(tmproot)
122
125
123 def extdiff(ui, repo, *pats, **opts):
126 def extdiff(ui, repo, *pats, **opts):
124 '''use external program to diff repository (or selected files)
127 '''use external program to diff repository (or selected files)
125
128
126 Show differences between revisions for the specified files, using
129 Show differences between revisions for the specified files, using
127 an external program. The default program used is diff, with
130 an external program. The default program used is diff, with
128 default options "-Npru".
131 default options "-Npru".
129
132
130 To select a different program, use the -p option. The program
133 To select a different program, use the -p option. The program
131 will be passed the names of two directories to compare. To pass
134 will be passed the names of two directories to compare. To pass
132 additional options to the program, use the -o option. These will
135 additional options to the program, use the -o option. These will
133 be passed before the names of the directories to compare.
136 be passed before the names of the directories to compare.
134
137
135 When two revision arguments are given, then changes are
138 When two revision arguments are given, then changes are
136 shown between those revisions. If only one revision is
139 shown between those revisions. If only one revision is
137 specified then that revision is compared to the working
140 specified then that revision is compared to the working
138 directory, and, when no revisions are specified, the
141 directory, and, when no revisions are specified, the
139 working directory files are compared to its parent.'''
142 working directory files are compared to its parent.'''
140 program = opts['program'] or 'diff'
143 program = opts['program'] or 'diff'
141 if opts['program']:
144 if opts['program']:
142 option = opts['option']
145 option = opts['option']
143 else:
146 else:
144 option = opts['option'] or ['-Npru']
147 option = opts['option'] or ['-Npru']
145 return dodiff(ui, repo, program, option, pats, opts)
148 return dodiff(ui, repo, program, option, pats, opts)
146
149
147 cmdtable = {
150 cmdtable = {
148 "extdiff":
151 "extdiff":
149 (extdiff,
152 (extdiff,
150 [('p', 'program', '', _('comparison program to run')),
153 [('p', 'program', '', _('comparison program to run')),
151 ('o', 'option', [], _('pass option to comparison program')),
154 ('o', 'option', [], _('pass option to comparison program')),
152 ('r', 'rev', [], _('revision')),
155 ('r', 'rev', [], _('revision')),
153 ('I', 'include', [], _('include names matching the given patterns')),
156 ('I', 'include', [], _('include names matching the given patterns')),
154 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
157 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
155 _('hg extdiff [OPT]... [FILE]...')),
158 _('hg extdiff [OPT]... [FILE]...')),
156 }
159 }
157
160
158 def uisetup(ui):
161 def uisetup(ui):
159 for cmd, path in ui.configitems('extdiff'):
162 for cmd, path in ui.configitems('extdiff'):
160 if not cmd.startswith('cmd.'): continue
163 if not cmd.startswith('cmd.'): continue
161 cmd = cmd[4:]
164 cmd = cmd[4:]
162 if not path: path = cmd
165 if not path: path = cmd
163 diffopts = ui.config('extdiff', 'opts.' + cmd, '')
166 diffopts = ui.config('extdiff', 'opts.' + cmd, '')
164 diffopts = diffopts and [diffopts] or []
167 diffopts = diffopts and [diffopts] or []
165 def save(cmd, path, diffopts):
168 def save(cmd, path, diffopts):
166 '''use closure to save diff command to use'''
169 '''use closure to save diff command to use'''
167 def mydiff(ui, repo, *pats, **opts):
170 def mydiff(ui, repo, *pats, **opts):
168 return dodiff(ui, repo, path, diffopts, pats, opts)
171 return dodiff(ui, repo, path, diffopts, pats, opts)
169 mydiff.__doc__ = '''use %(path)r to diff repository (or selected files)
172 mydiff.__doc__ = '''use %(path)r to diff repository (or selected files)
170
173
171 Show differences between revisions for the specified
174 Show differences between revisions for the specified
172 files, using the %(path)r program.
175 files, using the %(path)r program.
173
176
174 When two revision arguments are given, then changes are
177 When two revision arguments are given, then changes are
175 shown between those revisions. If only one revision is
178 shown between those revisions. If only one revision is
176 specified then that revision is compared to the working
179 specified then that revision is compared to the working
177 directory, and, when no revisions are specified, the
180 directory, and, when no revisions are specified, the
178 working directory files are compared to its parent.''' % {
181 working directory files are compared to its parent.''' % {
179 'path': path,
182 'path': path,
180 }
183 }
181 return mydiff
184 return mydiff
182 cmdtable[cmd] = (save(cmd, path, diffopts),
185 cmdtable[cmd] = (save(cmd, path, diffopts),
183 cmdtable['extdiff'][1][1:],
186 cmdtable['extdiff'][1][1:],
184 _('hg %s [OPT]... [FILE]...') % cmd)
187 _('hg %s [OPT]... [FILE]...') % cmd)
@@ -1,29 +1,38
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "extdiff=" >> $HGRCPATH
4 echo "extdiff=" >> $HGRCPATH
5
5
6 hg init a
6 hg init a
7 cd a
7 cd a
8 echo a > a
8 echo a > a
9 hg add
9 hg add
10 diff -N /dev/null /dev/null 2> /dev/null
10 diff -N /dev/null /dev/null 2> /dev/null
11 if [ $? -ne 0 ]; then
11 if [ $? -ne 0 ]; then
12 opt="-p gdiff"
12 opt="-p gdiff"
13 fi
13 fi
14 hg extdiff -o -Nr $opt
14 hg extdiff -o -Nr $opt
15
15
16 echo "[extdiff]" >> $HGRCPATH
16 echo "[extdiff]" >> $HGRCPATH
17 echo "cmd.falabala=echo" >> $HGRCPATH
17 echo "cmd.falabala=echo" >> $HGRCPATH
18 echo "opts.falabala=diffing" >> $HGRCPATH
18 echo "opts.falabala=diffing" >> $HGRCPATH
19
19
20 hg falabala
20 hg falabala
21
21
22 hg help falabala
22 hg help falabala
23
23
24 hg ci -d '0 0' -mtest1
24 hg ci -d '0 0' -mtest1
25
25
26 echo b >> a
26 echo b >> a
27 hg ci -d '1 0' -mtest2
27 hg ci -d '1 0' -mtest2
28
28
29 hg falabala -r 0:1 || echo "diff-like tools yield a non-zero exit code"
29 hg falabala -r 0:1
30
31 # test diff during merge
32 hg update 0
33 echo b >> b
34 hg add b
35 hg ci -m "new branch" -d '1 0'
36 hg update -C 1
37 hg merge tip
38 hg falabala || echo "diff-like tools yield a non-zero exit code"
@@ -1,32 +1,39
1 adding a
1 adding a
2 making snapshot of 0 files from rev 000000000000
2 making snapshot of 0 files from rev 000000000000
3 making snapshot of 1 files from working dir
3 making snapshot of 1 files from working dir
4 diff -Nr a.000000000000/a a/a
4 diff -Nr a.000000000000/a a/a
5 0a1
5 0a1
6 > a
6 > a
7 making snapshot of 0 files from rev 000000000000
7 making snapshot of 0 files from rev 000000000000
8 making snapshot of 1 files from working dir
8 making snapshot of 1 files from working dir
9 diffing a.000000000000 a
9 diffing a.000000000000 a
10 hg falabala [OPT]... [FILE]...
10 hg falabala [OPT]... [FILE]...
11
11
12 use 'echo' to diff repository (or selected files)
12 use 'echo' to diff repository (or selected files)
13
13
14 Show differences between revisions for the specified
14 Show differences between revisions for the specified
15 files, using the 'echo' program.
15 files, using the 'echo' program.
16
16
17 When two revision arguments are given, then changes are
17 When two revision arguments are given, then changes are
18 shown between those revisions. If only one revision is
18 shown between those revisions. If only one revision is
19 specified then that revision is compared to the working
19 specified then that revision is compared to the working
20 directory, and, when no revisions are specified, the
20 directory, and, when no revisions are specified, the
21 working directory files are compared to its parent.
21 working directory files are compared to its parent.
22
22
23 options:
23 options:
24
24
25 -o --option pass option to comparison program
25 -o --option pass option to comparison program
26 -r --rev revision
26 -r --rev revision
27 -I --include include names matching the given patterns
27 -I --include include names matching the given patterns
28 -X --exclude exclude names matching the given patterns
28 -X --exclude exclude names matching the given patterns
29 making snapshot of 1 files from rev e27a2475d60a
29 making snapshot of 1 files from rev e27a2475d60a
30 making snapshot of 1 files from rev 5e49ec8d3f05
30 making snapshot of 1 files from rev 5e49ec8d3f05
31 diffing a.e27a2475d60a a.5e49ec8d3f05
31 diffing a.e27a2475d60a a.5e49ec8d3f05
32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 (branch merge, don't forget to commit)
36 making snapshot of 1 files from rev 5e49ec8d3f05
37 making snapshot of 1 files from working dir
38 diffing a.5e49ec8d3f05 a
32 diff-like tools yield a non-zero exit code
39 diff-like tools yield a non-zero exit code
@@ -1,96 +1,104
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<'EOF' > merge
3 cat <<'EOF' > merge
4 #!/bin/sh
4 #!/bin/sh
5 echo merging for `basename $1`
5 echo merging for `basename $1`
6 EOF
6 EOF
7 chmod +x merge
7 chmod +x merge
8
8
9 mkdir t
9 mkdir t
10 cd t
10 cd t
11 hg init
11 hg init
12 echo This is file a1 > a
12 echo This is file a1 > a
13 hg add a
13 hg add a
14 hg commit -m "commit #0" -d "1000000 0"
14 hg commit -m "commit #0" -d "1000000 0"
15 echo This is file b1 > b
15 echo This is file b1 > b
16 hg add b
16 hg add b
17 hg commit -m "commit #1" -d "1000000 0"
17 hg commit -m "commit #1" -d "1000000 0"
18
18
19 hg update 0
19 hg update 0
20 echo This is file c1 > c
20 echo This is file c1 > c
21 hg add c
21 hg add c
22 hg commit -m "commit #2" -d "1000000 0"
22 hg commit -m "commit #2" -d "1000000 0"
23 echo This is file b1 > b
23 echo This is file b1 > b
24 echo %% no merges expected
24 echo %% no merges expected
25 env HGMERGE=../merge hg merge 1
25 env HGMERGE=../merge hg merge 1
26 hg diff --nodates
27 hg status
26 cd ..; /bin/rm -rf t
28 cd ..; /bin/rm -rf t
27
29
28 mkdir t
30 mkdir t
29 cd t
31 cd t
30 hg init
32 hg init
31 echo This is file a1 > a
33 echo This is file a1 > a
32 hg add a
34 hg add a
33 hg commit -m "commit #0" -d "1000000 0"
35 hg commit -m "commit #0" -d "1000000 0"
34 echo This is file b1 > b
36 echo This is file b1 > b
35 hg add b
37 hg add b
36 hg commit -m "commit #1" -d "1000000 0"
38 hg commit -m "commit #1" -d "1000000 0"
37
39
38 hg update 0
40 hg update 0
39 echo This is file c1 > c
41 echo This is file c1 > c
40 hg add c
42 hg add c
41 hg commit -m "commit #2" -d "1000000 0"
43 hg commit -m "commit #2" -d "1000000 0"
42 echo This is file b2 > b
44 echo This is file b2 > b
43 echo %% merge should fail
45 echo %% merge should fail
44 env HGMERGE=../merge hg merge 1
46 env HGMERGE=../merge hg merge 1
45 echo %% merge of b expected
47 echo %% merge of b expected
46 env HGMERGE=../merge hg merge -f 1
48 env HGMERGE=../merge hg merge -f 1
49 hg diff --nodates
50 hg status
47 cd ..; /bin/rm -rf t
51 cd ..; /bin/rm -rf t
48 echo %%
52 echo %%
49
53
50 mkdir t
54 mkdir t
51 cd t
55 cd t
52 hg init
56 hg init
53 echo This is file a1 > a
57 echo This is file a1 > a
54 hg add a
58 hg add a
55 hg commit -m "commit #0" -d "1000000 0"
59 hg commit -m "commit #0" -d "1000000 0"
56 echo This is file b1 > b
60 echo This is file b1 > b
57 hg add b
61 hg add b
58 hg commit -m "commit #1" -d "1000000 0"
62 hg commit -m "commit #1" -d "1000000 0"
59 echo This is file b22 > b
63 echo This is file b22 > b
60 hg commit -m "commit #2" -d "1000000 0"
64 hg commit -m "commit #2" -d "1000000 0"
61 hg update 1
65 hg update 1
62 echo This is file c1 > c
66 echo This is file c1 > c
63 hg add c
67 hg add c
64 hg commit -m "commit #3" -d "1000000 0"
68 hg commit -m "commit #3" -d "1000000 0"
65
69
66 echo 'Contents of b should be "this is file b1"'
70 echo 'Contents of b should be "this is file b1"'
67 cat b
71 cat b
68
72
69 echo This is file b22 > b
73 echo This is file b22 > b
70 echo %% merge fails
74 echo %% merge fails
71 env HGMERGE=../merge hg merge 2
75 env HGMERGE=../merge hg merge 2
72 echo %% merge expected!
76 echo %% merge expected!
73 env HGMERGE=../merge hg merge -f 2
77 env HGMERGE=../merge hg merge -f 2
78 hg diff --nodates
79 hg status
74 cd ..; /bin/rm -rf t
80 cd ..; /bin/rm -rf t
75
81
76 mkdir t
82 mkdir t
77 cd t
83 cd t
78 hg init
84 hg init
79 echo This is file a1 > a
85 echo This is file a1 > a
80 hg add a
86 hg add a
81 hg commit -m "commit #0" -d "1000000 0"
87 hg commit -m "commit #0" -d "1000000 0"
82 echo This is file b1 > b
88 echo This is file b1 > b
83 hg add b
89 hg add b
84 hg commit -m "commit #1" -d "1000000 0"
90 hg commit -m "commit #1" -d "1000000 0"
85 echo This is file b22 > b
91 echo This is file b22 > b
86 hg commit -m "commit #2" -d "1000000 0"
92 hg commit -m "commit #2" -d "1000000 0"
87 hg update 1
93 hg update 1
88 echo This is file c1 > c
94 echo This is file c1 > c
89 hg add c
95 hg add c
90 hg commit -m "commit #3" -d "1000000 0"
96 hg commit -m "commit #3" -d "1000000 0"
91 echo This is file b33 > b
97 echo This is file b33 > b
92 echo %% merge of b should fail
98 echo %% merge of b should fail
93 env HGMERGE=../merge hg merge 2
99 env HGMERGE=../merge hg merge 2
94 echo %% merge of b expected
100 echo %% merge of b expected
95 env HGMERGE=../merge hg merge -f 2
101 env HGMERGE=../merge hg merge -f 2
102 hg diff --nodates
103 hg status
96 cd ..; /bin/rm -rf t
104 cd ..; /bin/rm -rf t
@@ -1,33 +1,59
1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2 %% no merges expected
2 %% no merges expected
3 merging for b
3 merging for b
4 merging b
4 merging b
5 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
5 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
6 (branch merge, don't forget to commit)
6 (branch merge, don't forget to commit)
7 diff -r d9e5953b9dec b
8 --- /dev/null
9 +++ b/b
10 @@ -0,0 +1,1 @@
11 +This is file b1
12 M b
7 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
8 %% merge should fail
14 %% merge should fail
9 abort: 'b' already exists in the working dir and differs from remote
15 abort: 'b' already exists in the working dir and differs from remote
10 %% merge of b expected
16 %% merge of b expected
11 merging for b
17 merging for b
12 merging b
18 merging b
13 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
19 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
14 (branch merge, don't forget to commit)
20 (branch merge, don't forget to commit)
21 diff -r d9e5953b9dec b
22 --- /dev/null
23 +++ b/b
24 @@ -0,0 +1,1 @@
25 +This is file b2
26 M b
15 %%
27 %%
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 Contents of b should be "this is file b1"
29 Contents of b should be "this is file b1"
18 This is file b1
30 This is file b1
19 %% merge fails
31 %% merge fails
20 abort: outstanding uncommitted changes
32 abort: outstanding uncommitted changes
21 %% merge expected!
33 %% merge expected!
22 merging for b
34 merging for b
23 merging b
35 merging b
24 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
36 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
25 (branch merge, don't forget to commit)
37 (branch merge, don't forget to commit)
38 diff -r c1dd73cbf59f b
39 --- a/b
40 +++ b/b
41 @@ -1,1 +1,1 @@ This is file b1
42 -This is file b1
43 +This is file b22
44 M b
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 %% merge of b should fail
46 %% merge of b should fail
28 abort: outstanding uncommitted changes
47 abort: outstanding uncommitted changes
29 %% merge of b expected
48 %% merge of b expected
30 merging for b
49 merging for b
31 merging b
50 merging b
32 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
51 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
33 (branch merge, don't forget to commit)
52 (branch merge, don't forget to commit)
53 diff -r c1dd73cbf59f b
54 --- a/b
55 +++ b/b
56 @@ -1,1 +1,1 @@ This is file b1
57 -This is file b1
58 +This is file b33
59 M b
General Comments 0
You need to be logged in to leave comments. Login now