Mercurial > hgsubversion
annotate rebuildmeta.py @ 236:c34abd2448b7
Issue #60: Add a svn sub-command to list all authors in a Subversion repository
author | Daniel Tang <dytang@cs.purdue.edu> |
---|---|
date | Tue, 07 Apr 2009 22:15:22 -0400 |
parents | 33e885f5f86a |
children |
rev | line source |
---|---|
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import os |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 import pickle |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 from mercurial import node |
205
30df375590d1
Less fail with rebuildmeta url argument
Luke Opperman <luke@loppear.com>
parents:
196
diff
changeset
|
5 from mercurial import util as mutil |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 import svnwrap |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 import util |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 def rebuildmeta(ui, repo, hg_repo_path, args, **opts): |
185
57355b0e7bd1
Creating patch for documention messages.
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents:
181
diff
changeset
|
11 """rebuild hgsubversion metadata using values stored in revisions |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 """ |
205
30df375590d1
Less fail with rebuildmeta url argument
Luke Opperman <luke@loppear.com>
parents:
196
diff
changeset
|
13 if len(args) != 1: |
30df375590d1
Less fail with rebuildmeta url argument
Luke Opperman <luke@loppear.com>
parents:
196
diff
changeset
|
14 raise mutil.Abort('You must pass the svn URI used to create this repo.') |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 uuid = None |
205
30df375590d1
Less fail with rebuildmeta url argument
Luke Opperman <luke@loppear.com>
parents:
196
diff
changeset
|
16 url = args[0].rstrip('/') |
234
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
228
diff
changeset
|
17 user = opts.get('username', mutil.getuser()) |
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
228
diff
changeset
|
18 passwd = opts.get('password', '') |
33e885f5f86a
Add --username and --password options to all commands
Daniel Tang <dytang@cs.purdue.edu>
parents:
228
diff
changeset
|
19 svn = svnwrap.SubversionRepo(url, user, passwd) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 subdir = svn.subdir |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 svnmetadir = os.path.join(repo.path, 'svn') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 if not os.path.exists(svnmetadir): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 os.makedirs(svnmetadir) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 revmap = open(os.path.join(svnmetadir, 'rev_map'), 'w') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 revmap.write('1\n') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 last_rev = -1 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 branchinfo = {} |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 noderevnums = {} |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 for rev in repo: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 ctx = repo[rev] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 convinfo = ctx.extra().get('convert_revision', None) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 if convinfo: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 assert convinfo.startswith('svn:') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 revpath, revision = convinfo[40:].split('@') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 if subdir and subdir[0] != '/': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
37 subdir = '/' + subdir |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 if subdir and subdir[-1] == '/': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
39 subdir = subdir[:-1] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
40 assert revpath.startswith(subdir), ('That does not look like the ' |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 'right location in the repo.') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
42 if uuid is None: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
43 uuid = convinfo[4:40] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
44 assert uuid == svn.uuid, 'UUIDs did not match!' |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
45 urlfile = open(os.path.join(svnmetadir, 'url'), 'w') |
205
30df375590d1
Less fail with rebuildmeta url argument
Luke Opperman <luke@loppear.com>
parents:
196
diff
changeset
|
46 urlfile.write(url) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
47 urlfile.close() |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
48 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
49 uuidfile.write(uuid) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
50 uuidfile.close() |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
51 commitpath = revpath[len(subdir)+1:] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
52 if commitpath.startswith('branches'): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
53 commitpath = commitpath[len('branches/'):] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
54 elif commitpath == 'trunk': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
55 commitpath = '' |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
56 else: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
57 assert False, 'Unhandled case in rebuildmeta' |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
58 revmap.write('%s %s %s\n' % (revision, |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
59 node.hex(ctx.node()), |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
60 commitpath)) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
61 revision = int(revision) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
62 noderevnums[ctx.node()] = revision |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
63 if revision > last_rev: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
64 last_rev = revision |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
65 branch = ctx.branch() |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
66 if branch == 'default': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
67 branch = None |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
68 if branch not in branchinfo: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
69 parent = ctx.parents()[0] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
70 if (parent.node() in noderevnums |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
71 and parent.branch() != ctx.branch()): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
72 parentbranch = parent.branch() |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
73 if parentbranch == 'default': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
74 parentbranch = None |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
75 else: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
76 parentbranch = None |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
77 branchinfo[branch] = (parentbranch, |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
78 noderevnums.get(parent.node(), 0), |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
79 revision) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
80 for c in ctx.children(): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
81 if c.branch() == 'closed-branches': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
82 if branch in branchinfo: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
83 del branchinfo[branch] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
84 branchinfofile = open(os.path.join(svnmetadir, 'branch_info'), 'w') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
85 pickle.dump(branchinfo, branchinfofile) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
86 branchinfofile.close() |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
87 |
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
88 # now handle tags |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
89 tagsinfo = {} |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
90 realtags = svn.tags |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
91 tagsleft = realtags.items() |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
92 while tagsleft: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
93 tag, tagparent = tagsleft.pop(0) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
94 source, rev = tagparent |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
95 if source.startswith('tags/'): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
96 src = source[len('tags/'):] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
97 if src in tagsinfo: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
98 tagsinfo[tag] = tagsinfo[src] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
99 elif src in realtags: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
100 if (realtags[src][1] <= last_rev |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
101 or realtags[src][0].startswith('tags/')): |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
102 tagsleft.append(src) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
103 else: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
104 older_tags = svn.tags_at_rev(rev) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
105 newsrc, newrev = older_tags[src] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
106 tagsleft.append((tag, (newsrc, newrev))) |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
107 continue |
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
108 else: |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
109 source = determinebranch(source) |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
110 if rev <= last_rev and (source or 'default') in repo.branchtags(): |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
111 tagsinfo[tag] = source, rev |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
112 tagsinfofile = open(os.path.join(svnmetadir, 'tag_info'), 'w') |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
113 pickle.dump(tagsinfo, tagsinfofile) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
114 tagsinfofile.close() |
181
e37f9d3fd5e7
remove decorators (compat with python2.3)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
155
diff
changeset
|
115 rebuildmeta = util.register_subcommand('rebuildmeta')(rebuildmeta) |
196
77812f98e250
Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
Augie Fackler <durin42@gmail.com>
parents:
185
diff
changeset
|
116 rebuildmeta = util.command_needs_no_url(rebuildmeta) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
117 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
118 def determinebranch(branch): |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
119 assert not branch.startswith('tags/'), "Tags can't be tags of other tags." |
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
120 if branch.startswith('branches/'): |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
121 branch = branch[len('branches/'):] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
122 elif branch == 'trunk': |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
123 branch = None |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
124 else: |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
205
diff
changeset
|
125 branch = '../' + branch |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
126 return branch |