Mercurial > hgsubversion
annotate hgsubversion/svncommands.py @ 1019:d0f3a5c2cb56 stable 1.5.1
updatemeta/rebuildmeta: handle hidden changesets
author | Dan Villiom Podlaski Christiansen <dan@cabo.dk> |
---|---|
date | Mon, 13 May 2013 11:49:49 +0200 |
parents | 6b7ac659c855 |
children | f67f9d28b0ac |
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 |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
6 import urlparse |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
7 |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
8 from mercurial import commands |
242
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
9 from mercurial import hg |
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
10 from mercurial import node |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
11 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
|
12 from mercurial import error |
242
06130689a2c8
Move push into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
241
diff
changeset
|
13 |
448
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
14 import maps |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
15 import svnwrap |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
16 import svnrepo |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
17 import util |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
274
diff
changeset
|
18 import svnexternals |
897
6bc8046e3d0a
move verify to a file of its own
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
893
diff
changeset
|
19 import verify |
241
4950b18cf949
Move fetch_command.fetch_revisions() to svncommands.pull().
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
21 |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
22 def updatemeta(ui, repo, args, **opts): |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
23 """Do a partial rebuild of the subversion metadata. |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
24 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
25 Assumes that the metadata that currently exists is valid, but that |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
26 some is missing, e.g. because you have pulled some revisions via a |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
27 native mercurial method. |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
28 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
29 """ |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
30 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
31 return _buildmeta(ui, repo, args, partial=True) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
32 |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
384
diff
changeset
|
33 |
918
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
34 def rebuildmeta(ui, repo, args, unsafe_skip_uuid_check=False, **opts): |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
35 """rebuild hgsubversion metadata using values stored in revisions |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
36 """ |
918
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
37 return _buildmeta(ui, repo, args, partial=False, |
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
38 skipuuid=unsafe_skip_uuid_check) |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
39 |
918
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
40 def _buildmeta(ui, repo, args, partial=False, skipuuid=False): |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
41 |
573
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
42 if repo is None: |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
43 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
|
44 " here (.hg not found)") |
00393e9abff8
svncommands: make repo optional (useful for things like listauthors)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
566
diff
changeset
|
45 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
46 dest = None |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
47 if len(args) == 1: |
419
3ed71e63f64c
imported patch import-cleanup
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
414
diff
changeset
|
48 dest = args[0] |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
49 elif len(args) > 1: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
50 raise hgutil.Abort('rebuildmeta takes 1 or no arguments') |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
51 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
|
52 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
|
53 repo.ui.config('paths', 'default') or '') |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
54 svn = svnrepo.svnremoterepo(ui, url).svn |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
55 subdir = svn.subdir |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
56 svnmetadir = os.path.join(repo.path, 'svn') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
57 if not os.path.exists(svnmetadir): |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
58 os.makedirs(svnmetadir) |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
59 |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
60 youngest = 0 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
61 startrev = 0 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
62 sofar = [] |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
63 branchinfo = {} |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
64 if partial: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
65 try: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
66 youngestpath = os.path.join(svnmetadir, 'lastpulled') |
922
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
67 foundpartialinfo = False |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
68 if os.path.exists(youngestpath): |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
69 youngest = int(util.load_string(youngestpath).strip()) |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
70 sofar = list(maps.RevMap.readmapfile(repo)) |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
71 if sofar and len(sofar[-1].split(' ', 2)) > 1: |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
72 lasthash = sofar[-1].split(' ', 2)[1] |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
73 startrev = repo[lasthash].rev() + 1 |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
74 branchinfo = pickle.load(open(os.path.join(svnmetadir, |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
75 'branch_info'))) |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
76 foundpartialinfo = True |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
77 if not foundpartialinfo: |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
78 ui.status('missing some metadata -- doing a full rebuild\n') |
6b7ac659c855
updatemeta: correctly handle empty metadata
Jun Fang <junfang@fb.com>
parents:
918
diff
changeset
|
79 partial = False |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
80 except IOError, err: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
81 if err.errno != errno.ENOENT: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
82 raise |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
83 ui.status('missing some metadata -- doing a full rebuild') |
913
9fff2b8217b6
add except for AttributeError if youngestrepo doesn't exist
Brad Hall <bhall@fb.com>
parents:
897
diff
changeset
|
84 except AttributeError: |
9fff2b8217b6
add except for AttributeError if youngestrepo doesn't exist
Brad Hall <bhall@fb.com>
parents:
897
diff
changeset
|
85 ui.status('no metadata available -- doing a full rebuild') |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
86 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
87 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
88 lastpulled = open(os.path.join(svnmetadir, 'lastpulled'), 'wb') |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
89 revmap = open(os.path.join(svnmetadir, 'rev_map'), 'w') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
90 revmap.write('1\n') |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
91 revmap.writelines(sofar) |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
92 last_rev = -1 |
458
974102998578
rebuildmeta: remove any existing tagmap file.
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
93 tagfile = os.path.join(svnmetadir, 'tagmap') |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
94 if not partial and os.path.exists(maps.Tags.filepath(repo)) : |
728
cfefeefad199
rename TagMap to Tags, to free up the TagMap name
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
702
diff
changeset
|
95 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
|
96 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
|
97 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
98 layout = None |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
99 |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
100 skipped = set() |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
101 closed = set() |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
448
diff
changeset
|
102 |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
103 numrevs = len(repo) - startrev |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
104 |
748
e1e2af66953d
svnmeta: store subdir in a file, and verify it when loading.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
735
diff
changeset
|
105 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
|
106 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
|
107 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
|
108 |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
109 # 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
|
110 # 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
|
111 # 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
|
112 # changesets that close a branch, and store their first parent |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
113 for rev in xrange(startrev, len(repo)): |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
114 util.progress(ui, 'prepare', rev - startrev, total=numrevs) |
1019
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
115 try: |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
116 ctx = repo[rev] |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
117 except error.RepoError: |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
118 # this revision is hidden |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
119 continue |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
120 |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
121 convinfo = util.getsvnrev(ctx, None) |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
122 if not convinfo: |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
123 continue |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
124 svnrevnum = int(convinfo.rsplit('@', 1)[1]) |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
125 youngest = max(youngest, svnrevnum) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
126 |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
127 if ctx.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
|
128 continue |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
129 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
130 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
|
131 parentctx = ctx.parents()[0] |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
132 parentinfo = util.getsvnrev(parentctx, '@') |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
133 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
134 if droprev(parentinfo) == droprev(convinfo): |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
135 if parentctx.rev() < startrev: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
136 parentbranch = parentctx.branch() |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
137 if parentbranch == 'default': |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
138 parentbranch = None |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
139 branchinfo.pop(parentbranch) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
140 else: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
141 closed.add(parentctx.rev()) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
142 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
810
diff
changeset
|
143 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
|
144 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
|
145 |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
146 for rev in xrange(startrev, len(repo)): |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
147 util.progress(ui, 'rebuild', rev-startrev, total=numrevs) |
1019
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
148 try: |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
149 ctx = repo[rev] |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
150 except error.RepoError: |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
151 # this revision is hidden |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
152 continue |
d0f3a5c2cb56
updatemeta/rebuildmeta: handle hidden changesets
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
922
diff
changeset
|
153 |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
154 convinfo = util.getsvnrev(ctx, None) |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
155 if not convinfo: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
156 continue |
448
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
157 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
|
158 parent = ctx.parents()[0] |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
159 parentdata = '' |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
160 if '.hgtags' in parent: |
fbc7cf4fd701
tags: reinstate a tag map file in a better way
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
161 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
|
162 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
|
163 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
|
164 ha, tag = newtag.split(' ', 1) |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
165 tagged = util.getsvnrev(repo[ha], None) |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
166 if tagged is None: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
167 tagged = -1 |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
168 else: |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
169 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
|
170 # 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
|
171 # 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
|
172 # 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
|
173 # number. |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
174 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
|
175 tagrev = max(tagged, tagging) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
176 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
|
177 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
178 # 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
|
179 assert convinfo.startswith('svn:') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
180 revpath, revision = convinfo[40:].split('@') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
181 if subdir and subdir[0] != '/': |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
182 subdir = '/' + subdir |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
183 if subdir and subdir[-1] == '/': |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
184 subdir = subdir[:-1] |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
185 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
|
186 'right location in the repo.') |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
187 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
188 if layout is None: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
189 if (subdir or '/') == revpath: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
190 layout = 'single' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
191 else: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
192 layout = 'standard' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
193 f = open(os.path.join(svnmetadir, 'layout'), 'w') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
194 f.write(layout) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
195 f.close() |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
196 elif layout == 'single': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
197 assert (subdir or '/') == revpath, ('Possible layout detection' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
198 ' defect in replay') |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
199 |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
200 # write repository uuid if required |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
201 if uuid is None: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
202 uuid = convinfo[4:40] |
918
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
203 if not skipuuid: |
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
204 if uuid != svn.uuid: |
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
205 raise hgutil.Abort('remote svn repository identifier ' |
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
206 'does not match') |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
207 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') |
918
761a87134501
rebuildmeta: accept unrelated svn repo with --unsafe-skip-uuid-check
Patrick Mezard <patrick@mezard.eu>
parents:
913
diff
changeset
|
208 uuidfile.write(svn.uuid) |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
209 uuidfile.close() |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
210 |
423
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
211 # 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
|
212 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
|
213 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
|
214 skipped.add(ctx.node()) |
423
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
215 continue |
021bdbf391bb
put convert_revision in branch-closing csets
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
419
diff
changeset
|
216 |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
217 # find commitpath, write to revmap |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
218 commitpath = revpath[len(subdir)+1:] |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
219 if layout == 'standard': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
220 if commitpath.startswith('branches/'): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
221 commitpath = commitpath[len('branches/'):] |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
222 elif commitpath == 'trunk': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
223 commitpath = '' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
224 else: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
225 if commitpath.startswith('tags/') and ctx.extra().get('close'): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
226 continue |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
227 commitpath = '../' + commitpath |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
228 else: |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
493
diff
changeset
|
229 commitpath = '' |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
230 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
|
231 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
232 revision = int(revision) |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
233 if revision > last_rev: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
234 last_rev = revision |
375
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
371
diff
changeset
|
235 |
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
371
diff
changeset
|
236 # deal with branches |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
237 if not commitpath: |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
238 branch = None |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
239 elif not commitpath.startswith('../'): |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
240 branch = commitpath |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
241 elif ctx.parents()[0].node() != node.nullid: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
242 parent = ctx |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
243 while parent.node() != node.nullid: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
244 parentextra = parent.extra() |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
245 parentinfo = util.getsvnrev(parent) |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
246 assert parentinfo |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
247 parent = parent.parents()[0] |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
248 |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
249 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
|
250 |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
251 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
|
252 continue |
810
0b07a0c574bc
svncommands: fix weird missing newline after if statement
Augie Fackler <durin42@gmail.com>
parents:
774
diff
changeset
|
253 elif parentpath.startswith('branches/'): |
0b07a0c574bc
svncommands: fix weird missing newline after if statement
Augie Fackler <durin42@gmail.com>
parents:
774
diff
changeset
|
254 branch = parentpath[len('branches/'):] |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
255 elif parentpath == 'trunk': |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
256 branch = None |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
257 else: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
258 branch = '../' + parentpath |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
259 break |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
260 else: |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
261 branch = commitpath |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
262 |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
263 if rev in closed: |
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
264 # 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
|
265 branchinfo.pop(branch, None) |
641
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
266 elif ctx.extra().get('close'): |
67513cca972f
rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
637
diff
changeset
|
267 pass |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
268 elif branch not in branchinfo: |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
269 parent = ctx.parents()[0] |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
270 if (parent.node() not in skipped |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
271 and util.getsvnrev(parent, '').startswith('svn:') |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
272 and parent.branch() != ctx.branch()): |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
273 parentbranch = parent.branch() |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
274 if parentbranch == 'default': |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
275 parentbranch = None |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
276 else: |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
277 parentbranch = None |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
278 # branchinfo is a map from mercurial branch to a |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
279 # (svn branch, svn parent revision, svn revision) tuple |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
280 parentrev = util.getsvnrev(parent, '@').split('@')[1] or 0 |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
281 branchinfo[branch] = (parentbranch, |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
282 int(parentrev), |
371
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
283 revision) |
637
92f4a4b60696
rebuildmeta: optimize by removing quadratic time usage
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
616
diff
changeset
|
284 |
580
35529f736fa2
util: add progress wrapper to maintain 1.3 support
Augie Fackler <durin42@gmail.com>
parents:
578
diff
changeset
|
285 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
|
286 |
b45671850969
Add some comments for rebuildmeta, simplify a little.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
342
diff
changeset
|
287 # save off branch info |
246
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
288 branchinfofile = open(os.path.join(svnmetadir, 'branch_info'), 'w') |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
289 pickle.dump(branchinfo, branchinfofile) |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
290 branchinfofile.close() |
074f27c68818
Move rebuildmeta into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
244
diff
changeset
|
291 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
292 |
595
200770235bf0
svncommands: rename the `help' function to `help_'.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
580
diff
changeset
|
293 def help_(ui, args=None, **opts): |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
294 """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
|
295 """ |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
296 if args: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
297 subcommand = args[0] |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
298 if subcommand not in table: |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
299 candidates = [] |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
300 for c in table: |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
301 if c.startswith(subcommand): |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
302 candidates.append(c) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
303 if len(candidates) == 1: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
304 subcommand = candidates[0] |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
305 elif len(candidates) > 1: |
603
24c73f35f3cf
metacommand: use AmbiguousCommand from hg for consistency.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
599
diff
changeset
|
306 raise error.AmbiguousCommand(subcommand, candidates) |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
307 return |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
308 doc = table[subcommand].__doc__ |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
309 if doc is None: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
310 doc = "No documentation available for %s." % subcommand |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
311 ui.status(doc.strip(), '\n') |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
312 return |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
313 commands.help_(ui, 'svn') |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
314 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
315 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
316 def update(ui, args, repo, clean=False, **opts): |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
317 """update to a specified Subversion revision number |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
318 """ |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
319 |
755
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
320 try: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
321 rev = int(args[0]) |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
322 except IndexError: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
323 raise error.CommandError('svn', |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
324 "no revision number specified for 'update'") |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
325 except ValueError: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
326 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
|
327 % args[0]) |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
328 |
464
0f7095f53ca3
Extend svnrepos with SubversionRepo and SVNMeta
Patrick Mezard <pmezard@gmail.com>
parents:
463
diff
changeset
|
329 meta = repo.svnmeta() |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
330 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
331 answers = [] |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
332 for k, v in meta.revmap.iteritems(): |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
333 if k[0] == rev: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
334 answers.append((v, k[1])) |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
335 |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
336 if len(answers) == 1: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
337 if clean: |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
338 return hg.clean(repo, answers[0][0]) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
339 return hg.update(repo, answers[0][0]) |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
340 elif len(answers) == 0: |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
341 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
|
342 return 1 |
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
343 else: |
446
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
344 ui.status('ambiguous revision!\n') |
cbd230043379
svncommands: get update working again
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
441
diff
changeset
|
345 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
|
346 ui.status('\n'.join(revs)) |
247
1272e87546ed
Move help, update into svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
246
diff
changeset
|
347 return 1 |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
348 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
349 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
350 def genignore(ui, repo, force=False, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
351 """generate .hgignore from svn:ignore properties. |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
352 """ |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
353 |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
354 if repo is None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
355 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
|
356 " here (.hg not found)") |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
357 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
358 ignpath = repo.wjoin('.hgignore') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
359 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
|
360 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
|
361 svn = svnrepo.svnremoterepo(repo.ui).svn |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
362 meta = repo.svnmeta() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
363 hashes = meta.revmap.hashes() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
364 parent = util.parentrev(ui, repo, meta, hashes) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
365 r, br = hashes[parent.node()] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
366 if meta.layout == 'single': |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
367 branchpath = '' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
368 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
369 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
|
370 ignorelines = ['.hgignore', 'syntax:glob'] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
371 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
|
372 if d[1] == 'd'] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
373 for dir in dirs: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
374 path = '%s%s' % (branchpath, dir) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
375 props = svn.list_props(path, r) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
376 if 'svn:ignore' not in props: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
377 continue |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
378 lines = props['svn:ignore'].strip().split('\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
379 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
|
380 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
381 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
|
382 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
383 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
384 def info(ui, repo, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
385 """show Subversion details similar to `svn info' |
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 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
388 if repo is None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
389 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
|
390 " here (.hg not found)") |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
391 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
392 meta = repo.svnmeta() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
393 hashes = meta.revmap.hashes() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
394 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
395 if opts.get('rev'): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
396 parent = repo[opts['rev']] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
397 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
398 parent = util.parentrev(ui, repo, meta, hashes) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
399 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
400 pn = parent.node() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
401 if pn not in hashes: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
402 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
|
403 return 0 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
404 r, br = hashes[pn] |
884
1b261e0f85aa
Abstract away the details of where svn revs are stored in a commit
Bryan O'Sullivan <bryano@fb.com>
parents:
881
diff
changeset
|
405 subdir = util.getsvnrev(parent)[40:].split('@')[0] |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
406 if meta.layout == 'single': |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
407 branchpath = '' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
408 elif br == None: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
409 branchpath = '/trunk' |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
410 elif br.startswith('../'): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
411 branchpath = '/%s' % br[3:] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
412 subdir = subdir.replace('branches/../', '') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
413 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
414 branchpath = '/branches/%s' % br |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
415 remoterepo = svnrepo.svnremoterepo(repo.ui) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
416 url = '%s%s' % (remoterepo.svnurl, branchpath) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
417 author = meta.authors.reverselookup(parent.user()) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
418 # 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
|
419 reporoot = url[:len(url)-len(subdir)] |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
420 ui.write('''URL: %(url)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
421 Repository Root: %(reporoot)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
422 Repository UUID: %(uuid)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
423 Revision: %(revision)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
424 Node Kind: directory |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
425 Last Changed Author: %(author)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
426 Last Changed Rev: %(revision)s |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
427 Last Changed Date: %(date)s\n''' % |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
428 {'reporoot': reporoot, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
429 'uuid': meta.uuid, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
430 'url': url, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
431 'author': author, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
432 'revision': r, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
433 # 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
|
434 'date': hgutil.datestr(parent.date(), |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
435 '%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
|
436 }) |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
437 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
438 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
439 def listauthors(ui, args, authors=None, **opts): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
440 """list all authors in a Subversion repository |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
441 """ |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
442 if not len(args): |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
443 ui.status('No repository specified.\n') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
444 return |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
445 svn = svnrepo.svnremoterepo(ui, args[0]).svn |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
446 author_set = set() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
447 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
|
448 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
|
449 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
|
450 else: |
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
728
diff
changeset
|
451 author_set.add(rev.author) |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
452 if authors: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
453 authorfile = open(authors, 'w') |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
454 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
|
455 authorfile.close() |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
456 else: |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
457 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
|
458 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
459 |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
460 def _helpgen(): |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
461 ret = ['subcommands for Subversion integration', '', |
253
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
462 'list of subcommands:', ''] |
c3d5c4ae9c7c
Work with simple command table instead of decorators.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
247
diff
changeset
|
463 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
|
464 if func.__doc__: |
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
465 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
|
466 else: |
bc117ea4c95a
do not assume that doc-strings are present.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
467 short_description = '' |
598
e432b61c6d74
Use Mercurial-provided infrastructure for `svn' metacommand help.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
595
diff
changeset
|
468 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
|
469 return '\n'.join(ret) + '\n' |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
470 |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
471 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
|
472 '''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
|
473 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
474 # guess command if prefix |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
475 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
|
476 candidates = [] |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
477 for c in table: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
478 if c.startswith(subcommand): |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
479 candidates.append(c) |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
480 if len(candidates) == 1: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
481 subcommand = candidates[0] |
755
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
482 elif not candidates: |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
483 raise error.CommandError('svn', |
9c9565643704
svn metacommand: improved argument checking
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
754
diff
changeset
|
484 "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
|
485 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
486 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
|
487 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
488 # override subversion credentials |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
489 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
|
490 if key in opts: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
491 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
|
492 |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
493 try: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
494 commandfunc = table[subcommand] |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
495 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
|
496 except svnwrap.SubversionConnectionException, e: |
b70f7c82b9b8
svncommands: fix layering violation & tweak error messages.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
603
diff
changeset
|
497 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
|
498 except TypeError: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
499 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
|
500 if len(tb) == 1: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
501 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
|
502 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
503 raise |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
504 except KeyError, e: |
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('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
|
508 else: |
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
509 raise |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
510 |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
511 table = { |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
512 'genignore': genignore, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
513 'info': info, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
514 'listauthors': listauthors, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
515 'update': update, |
595
200770235bf0
svncommands: rename the `help' function to `help_'.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
580
diff
changeset
|
516 'help': help_, |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
885
diff
changeset
|
517 'updatemeta': updatemeta, |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
518 'rebuildmeta': rebuildmeta, |
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
519 'updateexternals': svnexternals.updateexternals, |
897
6bc8046e3d0a
move verify to a file of its own
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
893
diff
changeset
|
520 'verify': verify.verify, |
578
de384e4e0423
merge commands from utility_commands into svncommands
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
573
diff
changeset
|
521 } |
599
408869906fbf
Move the 'svn' metacommand into the 'svncommands' module.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
598
diff
changeset
|
522 svn.__doc__ = _helpgen() |