comparison svncommand.py @ 208:de3807ceea5c

Removed verify_* commands and replaced them with a shell script to pass to hg bisect --command.
author Augie Fackler <durin42@gmail.com>
date Mon, 09 Mar 2009 14:13:48 -0500
parents 77812f98e250
children 2165461d2dd8 1611834e39ee
comparison
equal deleted inserted replaced
207:b20a6c149021 208:de3807ceea5c
100 ui.status('Ambiguous revision!\n') 100 ui.status('Ambiguous revision!\n')
101 ui.status('\n'.join(['%s on %s' % (node.hex(a[0]), a[1]) for a in 101 ui.status('\n'.join(['%s on %s' % (node.hex(a[0]), a[1]) for a in
102 answers]+[''])) 102 answers]+['']))
103 return 1 103 return 1
104 update = register_subcommand('up')(update) 104 update = register_subcommand('up')(update)
105
106
107 def verify_revision(ui, args, repo, force=False, **opts):
108 """verify a single converted revision
109 Note: This wipes your working copy and then exports the corresponding
110 Subversion into your working copy to verify. Use with caution.
111 """
112 assert len(args) == 1
113 if not force:
114 assert repo.status(ignored=True,
115 unknown=True) == ([], [], [], [], [], [], [])
116 rev = int(args[0])
117 wc_path = os.path.dirname(repo.path)
118 svn_url = open(os.path.join(repo.path, 'svn', 'url')).read()
119 svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser())
120 util.wipe_all_files(wc_path)
121 if update(ui, args, repo, clean=True) == 0:
122 util.wipe_all_files(wc_path)
123 br = repo.dirstate.branch()
124 if br == 'default':
125 br = None
126 if br:
127 diff_path = 'branches/%s' % br
128 else:
129 diff_path = 'trunk'
130 svn.fetch_all_files_to_dir(diff_path, rev, wc_path)
131 stat = repo.status(unknown=True)
132 ignored = [s for s in stat[4]
133 if '/.svn/' not in s and not s.startswith('.svn/')]
134 stat = stat[0:4]
135 if stat != ([], [], [], [],) or ignored != []:
136 ui.status('Something is wrong with this revision.\n')
137 return 2
138 else:
139 ui.status('OK.\n')
140 return 0
141 return 1
142 verify_revision = register_subcommand('verify_revision')(verify_revision)
143
144 def verify_all_revisions(ui, args, repo, **opts):
145 """verify converted revisions; all or starting at a revision
146
147 Note: This is *extremely* abusive of the Subversion server. It exports every
148 revision of the code one revision at a time.
149 """
150 assert repo.status(ignored=True,
151 unknown=True) == ([], [], [], [], [], [], [])
152 start_rev = 0
153 args = list(args)
154 if args:
155 start_rev = int(args.pop(0))
156 revmap = util.parse_revmap(os.path.join(repo.path, 'svn', 'rev_map'))
157 revs = sorted(revmap.keys())
158 for revnum, br in revs:
159 if revnum < start_rev:
160 continue
161 res = verify_revision(ui, [revnum], repo, force=True)
162 if res == 0:
163 print revnum, 'verfied'
164 elif res == 1:
165 print revnum, 'skipped'
166 else:
167 print revnum, 'failed'
168 return 1
169 return 0
170 verify_all_revisions = register_subcommand('verify_all_revisions')(verify_all_revisions)