Mercurial > hgsubversion
annotate hgsubversion/svncommands.py @ 881:ce5837c64b12
svn verify: display extra and missing files separately
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Fri, 20 Apr 2012 17:58:55 +0200 |
parents | d4312a6f7a87 |
children | 1b261e0f85aa |
rev | line source |
---|---|
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
1 import os |
493
41c333473dda
try to deal with weirdly located branches in rebuildmeta (#118)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
474
diff
changeset
|
2 import posixpath |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
3 import cPickle as pickle |
616
532c545d162c
svncommands: add two missing imports
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
611
diff
changeset
|
4 import sys |
532c545d162c
svncommands: add two missing imports
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
611
diff
changeset
|
5 import traceback |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
6 |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
7 from mercurial import commands |
242
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
8 from mercurial import hg |
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
9 from mercurial import node |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
10 from mercurial import util as hgutil |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
11 from mercurial import error |
242
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
12 |
448
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
13 import maps |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
14 import svnwrap |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
15 import svnrepo |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
16 import util |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
274
diff
changeset
|
17 import svnexternals |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
18 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
19 |
774
144a2f6eb1af
svn verify: fix specifying URL on the command line
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
760
diff
changeset
|
20 def verify(ui, repo, args=None, **opts): |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
21 '''verify current revision against Subversion repository |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
22 ''' |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
23 |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
24 if repo is None: |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
25 raise error.RepoError("There is no Mercurial repository" |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
26 " here (.hg not found)") |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
27 |
441
de085126dbd4
svncommands: use rev instead of verifynode -- should not have to be a node
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
427
diff
changeset
|
28 ctx = repo[opts.get('rev', '.')] |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
29 if 'close' in ctx.extra(): |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
30 ui.write('cannot verify closed branch') |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
31 return 0 |
702
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
32 convert_revision = ctx.extra().get('convert_revision') |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
33 if convert_revision is None or not convert_revision.startswith('svn:'): |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
34 raise hgutil.Abort('revision %s not from SVN' % ctx) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
35 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
36 if args: |
702
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
37 url = repo.ui.expandpath(args[0]) |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
38 else: |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
39 url = repo.ui.expandpath('default') |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
40 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
41 svn = svnrepo.svnremoterepo(ui, url).svn |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
42 meta = repo.svnmeta(svn.uuid, svn.subdir) |
702
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
43 srev, branch, branchpath = meta.get_source_rev(ctx=ctx) |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
44 |
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
45 branchpath = branchpath[len(svn.subdir.lstrip('/')):] |
875
9cc3ed1f474d
svn verify: mention URL in output
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
857
diff
changeset
|
46 branchurl = ('%s/%s' % (url, branchpath)).strip('/') |
702
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
47 |
875
9cc3ed1f474d
svn verify: mention URL in output
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
857
diff
changeset
|
48 ui.write('verifying %s against %s@%i\n' % (ctx, branchurl, srev)) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
49 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
50 svnfiles = set() |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
51 result = 0 |
702
841399d10c79
verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
654
diff
changeset
|
52 |
853
5e1323a186fd
svn verify: progress information
Augie Fackler <durin42@gmail.com>
parents:
832
diff
changeset
|
53 svndata = svn.list_files(branchpath, srev) |
5e1323a186fd
svn verify: progress information
Augie Fackler <durin42@gmail.com>
parents:
832
diff
changeset
|
54 for i, (fn, type) in enumerate(svndata): |
5e1323a186fd
svn verify: progress information
Augie Fackler <durin42@gmail.com>
parents:
832
diff
changeset
|
55 util.progress(ui, 'verify', i) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
56 if type != 'f': |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
57 continue |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
58 svnfiles.add(fn) |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
59 fp = fn |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
60 if branchpath: |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
821
diff
changeset
|
61 fp = branchpath + '/' + fn |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
62 data, mode = svn.get_file(posixpath.normpath(fp), srev) |
856
2a034bd52d14
verify: skip over missing files instead of crashing
Bryan O'Sullivan <bryano@fb.com>
parents:
832
diff
changeset
|
63 try: |
2a034bd52d14
verify: skip over missing files instead of crashing
Bryan O'Sullivan <bryano@fb.com>
parents:
832
diff
changeset
|
64 fctx = ctx[fn] |
2a034bd52d14
verify: skip over missing files instead of crashing
Bryan O'Sullivan <bryano@fb.com>
parents:
832
diff
changeset
|
65 except error.LookupError: |
2a034bd52d14
verify: skip over missing files instead of crashing
Bryan O'Sullivan <bryano@fb.com>
parents:
832
diff
changeset
|
66 result = 1 |
2a034bd52d14
verify: skip over missing files instead of crashing
Bryan O'Sullivan <bryano@fb.com>
parents:
832
diff
changeset
|
67 continue |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
68 dmatch = fctx.data() == data |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
69 mmatch = fctx.flags() == mode |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
70 if not (dmatch and mmatch): |
654
e4f9603ab82a
verify: add end-of-line to ui.write() calls.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
641
diff
changeset
|
71 ui.write('difference in file %s\n' % fn) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
72 result = 1 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
73 |
760
bf1c27a89c76
Extract files not to be pushed in util
Patrick Mezard <pmezard@gmail.com>
parents:
755
diff
changeset
|
74 hgfiles = set(ctx) - util.ignoredfiles |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
75 if hgfiles != svnfiles: |
881
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
76 unexpected = hgfiles - svnfiles |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
77 if unexpected: |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
78 ui.write('unexpected files:\n') |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
79 for f in sorted(unexpected): |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
80 ui.write(' %s\n' % f) |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
81 missing = svnfiles - hgfiles |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
82 if missing: |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
83 ui.write('missing files:\n') |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
84 for f in sorted(missing): |
ce5837c64b12
svn verify: display extra and missing files separately
Patrick Mezard <patrick@mezard.eu>
parents:
880
diff
changeset
|
85 ui.write(' %s\n' % f) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
86 result = 1 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
87 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
88 return result |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
89 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
90 |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
91 def rebuildmeta(ui, repo, args, **opts): |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
92 """rebuild hgsubversion metadata using values stored in revisions |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
93 """ |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
94 |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
95 if repo is None: |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
96 raise error.RepoError("There is no Mercurial repository" |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
97 " here (.hg not found)") |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
98 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
99 dest = None |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
100 if len(args) == 1: |
419
3ed71e63f64c
imported patch import-cleanup
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
414
diff
changeset
|
101 dest = args[0] |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
102 elif len(args) > 1: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
103 raise hgutil.Abort('rebuildmeta takes 1 or no arguments') |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
104 uuid = None |
754
caa527346a0f
svncommands: abort on missing metadata or Subversion URL (fixes #226)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
748
diff
changeset
|
105 url = repo.ui.expandpath(dest or repo.ui.config('paths', 'default-push') or |
caa527346a0f
svncommands: abort on missing metadata or Subversion URL (fixes #226)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
748
diff
changeset
|
106 repo.ui.config('paths', 'default') or '') |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
107 svn = svnrepo.svnremoterepo(ui, url).svn |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
108 subdir = svn.subdir |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
109 svnmetadir = os.path.join(repo.path, 'svn') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
110 if not os.path.exists(svnmetadir): |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
111 os.makedirs(svnmetadir) |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
112 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
113 lastpulled = open(os.path.join(svnmetadir, 'lastpulled'), 'wb') |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
114 revmap = open(os.path.join(svnmetadir, 'rev_map'), 'w') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
115 revmap.write('1\n') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
116 last_rev = -1 |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
117 branchinfo = {} |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
118 noderevnums = {} |
458
974102998578
rebuildmeta: remove any existing tagmap file.
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
119 tagfile = os.path.join(svnmetadir, 'tagmap') |
728
cfefeefad199
rename TagMap to Tags, to free up the TagMap name
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
702
diff
changeset
|
120 if os.path.exists(maps.Tags.filepath(repo)): |
cfefeefad199
rename TagMap to Tags, to free up the TagMap name
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
702
diff
changeset
|
121 os.unlink(maps.Tags.filepath(repo)) |
cfefeefad199
rename TagMap to Tags, to free up the TagMap name
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
702
diff
changeset
|
122 tags = maps.Tags(repo) |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
123 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
124 layout = None |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
125 |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
126 skipped = set() |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
127 closed = set() |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
128 |
566
4a1a68713773
rebuildmeta: use ui.progress for better user feedback
Augie Fackler <durin42@gmail.com>
parents:
504
diff
changeset
|
129 numrevs = len(repo) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
130 |
748
e1e2af66953d
svnmeta: store subdir in a file, and verify it when loading.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
735
diff
changeset
|
131 subdirfile = open(os.path.join(svnmetadir, 'subdir'), 'w') |
e1e2af66953d
svnmeta: store subdir in a file, and verify it when loading.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
735
diff
changeset
|
132 subdirfile.write(subdir.strip('/')) |
e1e2af66953d
svnmeta: store subdir in a file, and verify it when loading.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
735
diff
changeset
|
133 subdirfile.close() |
e1e2af66953d
svnmeta: store subdir in a file, and verify it when loading.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
735
diff
changeset
|
134 |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
135 # ctx.children() visits all revisions in the repository after ctx. Calling |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
136 # it would make us use O(revisions^2) time, so we perform an extra traversal |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
137 # of the repository instead. During this traversal, we find all converted |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
138 # changesets that close a branch, and store their first parent |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
139 youngest = 0 |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
140 for rev in repo: |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
141 util.progress(ui, 'prepare', rev, total=numrevs) |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
142 ctx = repo[rev] |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
143 extra = ctx.extra() |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
144 convinfo = extra.get('convert_revision', None) |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
145 if not convinfo: |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
146 continue |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
147 svnrevnum = int(convinfo.rsplit('@', 1)[1]) |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
148 youngest = max(youngest, svnrevnum) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
149 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
150 if extra.get('close', None) is None: |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
151 continue |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
152 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
153 droprev = lambda x: x.rsplit('@', 1)[0] |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
154 parentctx = ctx.parents()[0] |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
155 parentinfo = parentctx.extra().get('convert_revision', '@') |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
156 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
157 if droprev(parentinfo) == droprev(convinfo): |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
158 closed.add(parentctx.rev()) |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
159 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
160 lastpulled.write(str(youngest) + '\n') |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
161 util.progress(ui, 'prepare', None, total=numrevs) |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
162 |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
163 for rev in repo: |
580
35529f736fa2
util: add progress wrapper to maintain 1.3 support
Augie Fackler <durin42@gmail.com>
parents:
578
diff
changeset
|
164 util.progress(ui, 'rebuild', rev, total=numrevs) |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
165 ctx = repo[rev] |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
166 convinfo = ctx.extra().get('convert_revision', None) |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
167 if not convinfo: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
168 continue |
448
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
169 if '.hgtags' in ctx.files(): |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
170 parent = ctx.parents()[0] |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
171 parentdata = '' |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
172 if '.hgtags' in parent: |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
173 parentdata = parent.filectx('.hgtags').data() |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
174 newdata = ctx.filectx('.hgtags').data() |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
175 for newtag in newdata[len(parentdata):-1].split('\n'): |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
176 ha, tag = newtag.split(' ', 1) |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
177 tagged = repo[ha].extra().get('convert_revision', None) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
178 if tagged is None: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
179 tagged = -1 |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
180 else: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
181 tagged = int(tagged[40:].split('@')[1]) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
182 # This is max(tagged rev, tagging rev) because if it is a normal |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
183 # tag, the tagging revision has the right rev number. However, if it |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
184 # was an edited tag, then the tagged revision has the correct revision |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
185 # number. |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
186 tagging = int(convinfo[40:].split('@')[1]) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
187 tagrev = max(tagged, tagging) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
188 tags[tag] = node.bin(ha), tagrev |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
189 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
190 # check that the conversion metadata matches expectations |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
191 assert convinfo.startswith('svn:') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
192 revpath, revision = convinfo[40:].split('@') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
193 if subdir and subdir[0] != '/': |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
194 subdir = '/' + subdir |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
195 if subdir and subdir[-1] == '/': |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
196 subdir = subdir[:-1] |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
197 assert revpath.startswith(subdir), ('That does not look like the ' |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
198 'right location in the repo.') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
199 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
200 if layout is None: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
201 if (subdir or '/') == revpath: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
202 layout = 'single' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
203 else: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
204 layout = 'standard' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
205 f = open(os.path.join(svnmetadir, 'layout'), 'w') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
206 f.write(layout) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
207 f.close() |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
208 elif layout == 'single': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
209 assert (subdir or '/') == revpath, ('Possible layout detection' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
210 ' defect in replay') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
211 |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
212 # write repository uuid if required |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
213 if uuid is None: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
214 uuid = convinfo[4:40] |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
215 assert uuid == svn.uuid, 'UUIDs did not match!' |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
216 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
217 uuidfile.write(uuid) |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
218 uuidfile.close() |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
219 |
423
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
220 # don't reflect closed branches |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
221 if (ctx.extra().get('close') and not ctx.files() or |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
222 ctx.parents()[0].node() in skipped): |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
223 skipped.add(ctx.node()) |
423
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
224 continue |
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
225 |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
226 # find commitpath, write to revmap |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
227 commitpath = revpath[len(subdir)+1:] |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
228 if layout == 'standard': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
229 if commitpath.startswith('branches/'): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
230 commitpath = commitpath[len('branches/'):] |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
231 elif commitpath == 'trunk': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
232 commitpath = '' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
233 else: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
234 if commitpath.startswith('tags/') and ctx.extra().get('close'): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
235 continue |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
236 commitpath = '../' + commitpath |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
237 else: |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
238 commitpath = '' |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
239 revmap.write('%s %s %s\n' % (revision, ctx.hex(), commitpath)) |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
240 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
241 revision = int(revision) |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
242 noderevnums[ctx.node()] = revision |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
243 if revision > last_rev: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
244 last_rev = revision |
375
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
371
diff
changeset
|
245 |
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
371
diff
changeset
|
246 # deal with branches |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
247 if not commitpath: |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
248 branch = None |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
249 elif not commitpath.startswith('../'): |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
250 branch = commitpath |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
251 elif ctx.parents()[0].node() != node.nullid: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
252 parent = ctx |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
253 while parent.node() != node.nullid: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
254 parentextra = parent.extra() |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
255 parentinfo = parentextra.get('convert_revision') |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
256 assert parentinfo |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
257 parent = parent.parents()[0] |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
258 |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
259 parentpath = parentinfo[40:].split('@')[0][len(subdir) + 1:] |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
260 |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
261 if parentpath.startswith('tags/') and parentextra.get('close'): |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
262 continue |
810
0b07a0c574bc
svncommands: fix weird missing newline after if statement
Augie Fackler <durin42@gmail.com>
parents:
774
diff
changeset
|
263 elif parentpath.startswith('branches/'): |
0b07a0c574bc
svncommands: fix weird missing newline after if statement
Augie Fackler <durin42@gmail.com>
parents:
774
diff
changeset
|
264 branch = parentpath[len('branches/'):] |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
265 elif parentpath == 'trunk': |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
266 branch = None |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
267 else: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
268 branch = '../' + parentpath |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
269 break |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
270 else: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
271 branch = commitpath |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
272 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
273 if rev in closed: |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
274 # a direct child of this changeset closes the branch; drop it |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
275 branchinfo.pop(branch, None) |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
276 elif ctx.extra().get('close'): |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
277 pass |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
278 elif branch not in branchinfo: |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
279 parent = ctx.parents()[0] |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
280 if (parent.node() in noderevnums |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
281 and parent.branch() != ctx.branch()): |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
282 parentbranch = parent.branch() |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
283 if parentbranch == 'default': |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
284 parentbranch = None |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
285 else: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
286 parentbranch = None |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
287 branchinfo[branch] = (parentbranch, |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
288 noderevnums.get(parent.node(), 0), |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
289 revision) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
290 |
580
35529f736fa2
util: add progress wrapper to maintain 1.3 support
Augie Fackler <durin42@gmail.com>
parents:
578
diff
changeset
|
291 util.progress(ui, 'rebuild', None, total=numrevs) |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
292 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
293 # save off branch info |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
294 branchinfofile = open(os.path.join(svnmetadir, 'branch_info'), 'w') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
295 pickle.dump(branchinfo, branchinfofile) |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
296 branchinfofile.close() |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
297 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
298 |
595
200770235bf0
svncommands: rename the `help' function to `help_'.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
580
diff
changeset
|
299 def help_(ui, args=None, **opts): |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
300 """show help for a given subcommands or a help overview |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
301 """ |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
302 if args: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
303 subcommand = args[0] |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
304 if subcommand not in table: |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
305 candidates = [] |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
306 for c in table: |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
307 if c.startswith(subcommand): |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
308 candidates.append(c) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
309 if len(candidates) == 1: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
310 subcommand = candidates[0] |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
311 elif len(candidates) > 1: |
603
24c73f35f3cf
metacommand: use AmbiguousCommand from hg for consistency.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
599
diff
changeset
|
312 raise error.AmbiguousCommand(subcommand, candidates) |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
313 return |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
314 doc = table[subcommand].__doc__ |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
315 if doc is None: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
316 doc = "No documentation available for %s." % subcommand |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
317 ui.status(doc.strip(), '\n') |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
318 return |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
319 commands.help_(ui, 'svn') |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
320 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
321 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
322 def update(ui, args, repo, clean=False, **opts): |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
323 """update to a specified Subversion revision number |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
324 """ |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
325 |
755
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
326 try: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
327 rev = int(args[0]) |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
328 except IndexError: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
329 raise error.CommandError('svn', |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
330 "no revision number specified for 'update'") |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
331 except ValueError: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
332 raise error.Abort("'%s' is not a valid Subversion revision number" |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
333 % args[0]) |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
334 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
335 meta = repo.svnmeta() |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
336 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
337 answers = [] |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
338 for k, v in meta.revmap.iteritems(): |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
339 if k[0] == rev: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
340 answers.append((v, k[1])) |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
341 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
342 if len(answers) == 1: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
343 if clean: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
344 return hg.clean(repo, answers[0][0]) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
345 return hg.update(repo, answers[0][0]) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
346 elif len(answers) == 0: |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
347 ui.status('revision %s did not produce an hg revision\n' % rev) |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
348 return 1 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
349 else: |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
350 ui.status('ambiguous revision!\n') |
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
351 revs = ['%s on %s' % (node.hex(a[0]), a[1]) for a in answers] + [''] |
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
352 ui.status('\n'.join(revs)) |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
353 return 1 |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
354 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
355 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
356 def genignore(ui, repo, force=False, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
357 """generate .hgignore from svn:ignore properties. |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
358 """ |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
359 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
360 if repo is None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
361 raise error.RepoError("There is no Mercurial repository" |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
362 " here (.hg not found)") |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
363 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
364 ignpath = repo.wjoin('.hgignore') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
365 if not force and os.path.exists(ignpath): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
366 raise hgutil.Abort('not overwriting existing .hgignore, try --force?') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
367 svn = svnrepo.svnremoterepo(repo.ui).svn |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
368 meta = repo.svnmeta() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
369 hashes = meta.revmap.hashes() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
370 parent = util.parentrev(ui, repo, meta, hashes) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
371 r, br = hashes[parent.node()] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
372 if meta.layout == 'single': |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
373 branchpath = '' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
374 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
375 branchpath = br and ('branches/%s/' % br) or 'trunk/' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
376 ignorelines = ['.hgignore', 'syntax:glob'] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
377 dirs = [''] + [d[0] for d in svn.list_files(branchpath, r) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
378 if d[1] == 'd'] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
379 for dir in dirs: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
380 path = '%s%s' % (branchpath, dir) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
381 props = svn.list_props(path, r) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
382 if 'svn:ignore' not in props: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
383 continue |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
384 lines = props['svn:ignore'].strip().split('\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
385 ignorelines += [dir and (dir + '/' + prop) or prop for prop in lines] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
386 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
387 repo.wopener('.hgignore', 'w').write('\n'.join(ignorelines) + '\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
388 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
389 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
390 def info(ui, repo, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
391 """show Subversion details similar to `svn info' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
392 """ |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
393 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
394 if repo is None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
395 raise error.RepoError("There is no Mercurial repository" |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
396 " here (.hg not found)") |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
397 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
398 meta = repo.svnmeta() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
399 hashes = meta.revmap.hashes() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
400 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
401 if opts.get('rev'): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
402 parent = repo[opts['rev']] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
403 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
404 parent = util.parentrev(ui, repo, meta, hashes) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
405 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
406 pn = parent.node() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
407 if pn not in hashes: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
408 ui.status('Not a child of an svn revision.\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
409 return 0 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
410 r, br = hashes[pn] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
411 subdir = parent.extra()['convert_revision'][40:].split('@')[0] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
412 if meta.layout == 'single': |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
413 branchpath = '' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
414 elif br == None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
415 branchpath = '/trunk' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
416 elif br.startswith('../'): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
417 branchpath = '/%s' % br[3:] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
418 subdir = subdir.replace('branches/../', '') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
419 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
420 branchpath = '/branches/%s' % br |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
421 remoterepo = svnrepo.svnremoterepo(repo.ui) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
422 url = '%s%s' % (remoterepo.svnurl, branchpath) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
423 author = meta.authors.reverselookup(parent.user()) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
424 # cleverly figure out repo root w/o actually contacting the server |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
425 reporoot = url[:len(url)-len(subdir)] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
426 ui.write('''URL: %(url)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
427 Repository Root: %(reporoot)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
428 Repository UUID: %(uuid)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
429 Revision: %(revision)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
430 Node Kind: directory |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
431 Last Changed Author: %(author)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
432 Last Changed Rev: %(revision)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
433 Last Changed Date: %(date)s\n''' % |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
434 {'reporoot': reporoot, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
435 'uuid': meta.uuid, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
436 'url': url, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
437 'author': author, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
438 'revision': r, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
439 # TODO I'd like to format this to the user's local TZ if possible |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
440 'date': hgutil.datestr(parent.date(), |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
441 '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
442 }) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
443 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
444 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
445 def listauthors(ui, args, authors=None, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
446 """list all authors in a Subversion repository |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
447 """ |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
448 if not len(args): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
449 ui.status('No repository specified.\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
450 return |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
451 svn = svnrepo.svnremoterepo(ui, args[0]).svn |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
452 author_set = set() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
453 for rev in svn.revisions(): |
735
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
728
diff
changeset
|
454 if rev.author is None: |
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
728
diff
changeset
|
455 author_set.add('(no author)') |
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
728
diff
changeset
|
456 else: |
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
728
diff
changeset
|
457 author_set.add(rev.author) |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
458 if authors: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
459 authorfile = open(authors, 'w') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
460 authorfile.write('%s=\n' % '=\n'.join(sorted(author_set))) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
461 authorfile.close() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
462 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
463 ui.write('%s\n' % '\n'.join(sorted(author_set))) |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
464 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
465 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
466 def _helpgen(): |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
467 ret = ['subcommands for Subversion integration', '', |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
468 'list of subcommands:', ''] |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
469 for name, func in sorted(table.items()): |
504
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
470 if func.__doc__: |
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
471 short_description = func.__doc__.splitlines()[0] |
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
472 else: |
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
473 short_description = '' |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
474 ret.append(" :%s: %s" % (name, short_description)) |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
475 return '\n'.join(ret) + '\n' |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
476 |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
477 def svn(ui, repo, subcommand, *args, **opts): |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
478 '''see detailed help for list of subcommands''' |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
479 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
480 # guess command if prefix |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
481 if subcommand not in table: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
482 candidates = [] |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
483 for c in table: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
484 if c.startswith(subcommand): |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
485 candidates.append(c) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
486 if len(candidates) == 1: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
487 subcommand = candidates[0] |
755
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
488 elif not candidates: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
489 raise error.CommandError('svn', |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
490 "unknown subcommand '%s'" % subcommand) |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
491 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
492 raise error.AmbiguousCommand(subcommand, candidates) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
493 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
494 # override subversion credentials |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
495 for key in ('username', 'password'): |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
496 if key in opts: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
497 ui.setconfig('hgsubversion', key, opts[key]) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
498 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
499 try: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
500 commandfunc = table[subcommand] |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
501 return commandfunc(ui, args=args, repo=repo, **opts) |
611
b70f7c82b9b8
svncommands: fix layering violation & tweak error messages.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
603
diff
changeset
|
502 except svnwrap.SubversionConnectionException, e: |
b70f7c82b9b8
svncommands: fix layering violation & tweak error messages.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
603
diff
changeset
|
503 raise hgutil.Abort(*e.args) |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
504 except TypeError: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
505 tb = traceback.extract_tb(sys.exc_info()[2]) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
506 if len(tb) == 1: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
507 ui.status('Bad arguments for subcommand %s\n' % subcommand) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
508 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
509 raise |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
510 except KeyError, e: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
511 tb = traceback.extract_tb(sys.exc_info()[2]) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
512 if len(tb) == 1: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
513 ui.status('Unknown subcommand %s\n' % subcommand) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
514 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
515 raise |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
516 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
517 table = { |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
518 'genignore': genignore, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
519 'info': info, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
520 'listauthors': listauthors, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
521 'update': update, |
595
200770235bf0
svncommands: rename the `help' function to `help_'.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
580
diff
changeset
|
522 'help': help_, |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
523 'rebuildmeta': rebuildmeta, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
524 'updateexternals': svnexternals.updateexternals, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
525 'verify': verify, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
526 } |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
527 svn.__doc__ = _helpgen() |