Show More
@@ -0,0 +1,42 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # Test basic extension support | |||
|
3 | ||||
|
4 | cat > foobar.py <<EOF | |||
|
5 | import os | |||
|
6 | from mercurial import commands | |||
|
7 | ||||
|
8 | def uisetup(ui): | |||
|
9 | ui.write("uisetup called\\n") | |||
|
10 | ||||
|
11 | def reposetup(ui, repo): | |||
|
12 | ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) | |||
|
13 | ||||
|
14 | def foo(ui, *args, **kwargs): | |||
|
15 | ui.write("Foo\\n") | |||
|
16 | ||||
|
17 | def bar(ui, *args, **kwargs): | |||
|
18 | ui.write("Bar\\n") | |||
|
19 | ||||
|
20 | cmdtable = { | |||
|
21 | "foo": (foo, [], "hg foo"), | |||
|
22 | "bar": (bar, [], "hg bar"), | |||
|
23 | } | |||
|
24 | ||||
|
25 | commands.norepo += ' bar' | |||
|
26 | EOF | |||
|
27 | abspath=`pwd`/foobar.py | |||
|
28 | ||||
|
29 | hg init a | |||
|
30 | cd a | |||
|
31 | echo foo > file | |||
|
32 | hg add file | |||
|
33 | hg commit -m 'add file' | |||
|
34 | ||||
|
35 | echo '[extensions]' >> $HGRCPATH | |||
|
36 | echo "foobar = $abspath" >> $HGRCPATH | |||
|
37 | hg foo | |||
|
38 | ||||
|
39 | cd .. | |||
|
40 | hg clone a b | |||
|
41 | ||||
|
42 | hg bar |
@@ -0,0 +1,9 b'' | |||||
|
1 | uisetup called | |||
|
2 | reposetup called for a | |||
|
3 | Foo | |||
|
4 | uisetup called | |||
|
5 | reposetup called for a | |||
|
6 | reposetup called for b | |||
|
7 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
8 | uisetup called | |||
|
9 | Bar |
@@ -678,9 +678,10 b' class queue:' | |||||
678 | while True: |
|
678 | while True: | |
679 | seen[n] = 1 |
|
679 | seen[n] = 1 | |
680 | pp = chlog.parents(n) |
|
680 | pp = chlog.parents(n) | |
681 |
if pp[1] != revlog.nullid |
|
681 | if pp[1] != revlog.nullid: | |
682 |
|
|
682 | for p in pp: | |
683 | heads.append(pp[1]) |
|
683 | if chlog.rev(p) > revnum and p not in seen: | |
|
684 | heads.append(p) | |||
684 | if pp[0] == revlog.nullid: |
|
685 | if pp[0] == revlog.nullid: | |
685 | break |
|
686 | break | |
686 | if chlog.rev(pp[0]) < revnum: |
|
687 | if chlog.rev(pp[0]) < revnum: |
@@ -2486,7 +2486,7 b' def unbundle(ui, repo, fname, **opts):' | |||||
2486 | command. |
|
2486 | command. | |
2487 | """ |
|
2487 | """ | |
2488 | if os.path.exists(fname): |
|
2488 | if os.path.exists(fname): | |
2489 | f = open(fname) |
|
2489 | f = open(fname, "rb") | |
2490 | else: |
|
2490 | else: | |
2491 | f = urllib.urlopen(fname) |
|
2491 | f = urllib.urlopen(fname) | |
2492 | gen = changegroup.readbundle(f, fname) |
|
2492 | gen = changegroup.readbundle(f, fname) | |
@@ -3069,6 +3069,9 b' def load_extensions(ui):' | |||||
3069 | uisetup = getattr(mod, 'uisetup', None) |
|
3069 | uisetup = getattr(mod, 'uisetup', None) | |
3070 | if uisetup: |
|
3070 | if uisetup: | |
3071 | uisetup(ui) |
|
3071 | uisetup(ui) | |
|
3072 | reposetup = getattr(mod, 'reposetup', None) | |||
|
3073 | if reposetup: | |||
|
3074 | hg.repo_setup_hooks.append(reposetup) | |||
3072 | cmdtable = getattr(mod, 'cmdtable', {}) |
|
3075 | cmdtable = getattr(mod, 'cmdtable', {}) | |
3073 | overrides = [cmd for cmd in cmdtable if cmd in table] |
|
3076 | overrides = [cmd for cmd in cmdtable if cmd in table] | |
3074 | if overrides: |
|
3077 | if overrides: | |
@@ -3152,11 +3155,6 b' def dispatch(args):' | |||||
3152 | if not repo: |
|
3155 | if not repo: | |
3153 | repo = hg.repository(u, path=path) |
|
3156 | repo = hg.repository(u, path=path) | |
3154 | u = repo.ui |
|
3157 | u = repo.ui | |
3155 | for name in external.itervalues(): |
|
|||
3156 | mod = sys.modules[name] |
|
|||
3157 | if hasattr(mod, 'reposetup'): |
|
|||
3158 | mod.reposetup(u, repo) |
|
|||
3159 | hg.repo_setup_hooks.append(mod.reposetup) |
|
|||
3160 | except hg.RepoError: |
|
3158 | except hg.RepoError: | |
3161 | if cmd not in optionalrepo.split(): |
|
3159 | if cmd not in optionalrepo.split(): | |
3162 | raise |
|
3160 | raise |
@@ -579,7 +579,7 b' def copyfile(src, dest):' | |||||
579 | shutil.copyfile(src, dest) |
|
579 | shutil.copyfile(src, dest) | |
580 | shutil.copymode(src, dest) |
|
580 | shutil.copymode(src, dest) | |
581 | except shutil.Error, inst: |
|
581 | except shutil.Error, inst: | |
582 |
raise |
|
582 | raise Abort(str(inst)) | |
583 |
|
583 | |||
584 | def copyfiles(src, dst, hardlink=None): |
|
584 | def copyfiles(src, dst, hardlink=None): | |
585 | """Copy a directory tree using hardlinks if possible""" |
|
585 | """Copy a directory tree using hardlinks if possible""" |
@@ -18,10 +18,13 b' import util' | |||||
18 | unknown_version = 'unknown' |
|
18 | unknown_version = 'unknown' | |
19 | remembered_version = False |
|
19 | remembered_version = False | |
20 |
|
20 | |||
21 | def get_version(): |
|
21 | def get_version(doreload=False): | |
22 | """Return version information if available.""" |
|
22 | """Return version information if available.""" | |
23 | try: |
|
23 | try: | |
24 |
|
|
24 | import mercurial.__version__ | |
|
25 | if doreload: | |||
|
26 | reload(mercurial.__version__) | |||
|
27 | version = mercurial.__version__.version | |||
25 | except ImportError: |
|
28 | except ImportError: | |
26 | version = unknown_version |
|
29 | version = unknown_version | |
27 | return version |
|
30 | return version | |
@@ -40,6 +43,8 b' def write_version(version):' | |||||
40 | f.write("# This file is auto-generated.\n") |
|
43 | f.write("# This file is auto-generated.\n") | |
41 | f.write("version = %r\n" % version) |
|
44 | f.write("version = %r\n" % version) | |
42 | f.close() |
|
45 | f.close() | |
|
46 | # reload the file we've just written | |||
|
47 | get_version(True) | |||
43 |
|
48 | |||
44 | def remember_version(version=None): |
|
49 | def remember_version(version=None): | |
45 | """Store version information.""" |
|
50 | """Store version information.""" |
@@ -246,3 +246,22 b' hg mv bleh barney' | |||||
246 | hg qrefresh --git |
|
246 | hg qrefresh --git | |
247 | cat .hg/patches/bar |
|
247 | cat .hg/patches/bar | |
248 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
248 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . | |
|
249 | ||||
|
250 | echo '% strip again' | |||
|
251 | cd .. | |||
|
252 | hg init strip | |||
|
253 | cd strip | |||
|
254 | touch foo | |||
|
255 | hg add foo | |||
|
256 | hg ci -m 'add foo' -d '0 0' | |||
|
257 | echo >> foo | |||
|
258 | hg ci -m 'change foo 1' -d '0 0' | |||
|
259 | hg up -C 0 | |||
|
260 | echo 1 >> foo | |||
|
261 | hg ci -m 'change foo 2' -d '0 0' | |||
|
262 | HGMERGE=true hg merge | |||
|
263 | hg ci -m merge -d '0 0' | |||
|
264 | hg log | |||
|
265 | hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' | |||
|
266 | hg log | |||
|
267 |
@@ -264,3 +264,52 b' new file mode 100644' | |||||
264 | @@ -0,0 +1,1 @@ |
|
264 | @@ -0,0 +1,1 @@ | |
265 | +bar |
|
265 | +bar | |
266 | 3 barney (foo) |
|
266 | 3 barney (foo) | |
|
267 | % strip again | |||
|
268 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
269 | merging foo | |||
|
270 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
271 | (branch merge, don't forget to commit) | |||
|
272 | changeset: 3:99615015637b | |||
|
273 | tag: tip | |||
|
274 | parent: 2:20cbbe65cff7 | |||
|
275 | parent: 1:d2871fc282d4 | |||
|
276 | user: test | |||
|
277 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
278 | summary: merge | |||
|
279 | ||||
|
280 | changeset: 2:20cbbe65cff7 | |||
|
281 | parent: 0:53245c60e682 | |||
|
282 | user: test | |||
|
283 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
284 | summary: change foo 2 | |||
|
285 | ||||
|
286 | changeset: 1:d2871fc282d4 | |||
|
287 | user: test | |||
|
288 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
289 | summary: change foo 1 | |||
|
290 | ||||
|
291 | changeset: 0:53245c60e682 | |||
|
292 | user: test | |||
|
293 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
294 | summary: add foo | |||
|
295 | ||||
|
296 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
297 | saving bundle to | |||
|
298 | saving bundle to | |||
|
299 | adding branch | |||
|
300 | adding changesets | |||
|
301 | adding manifests | |||
|
302 | adding file changes | |||
|
303 | added 1 changesets with 1 changes to 1 files | |||
|
304 | (run 'hg update' to get a working copy) | |||
|
305 | changeset: 1:20cbbe65cff7 | |||
|
306 | tag: tip | |||
|
307 | user: test | |||
|
308 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
309 | summary: change foo 2 | |||
|
310 | ||||
|
311 | changeset: 0:53245c60e682 | |||
|
312 | user: test | |||
|
313 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
314 | summary: add foo | |||
|
315 |
General Comments 0
You need to be logged in to leave comments.
Login now