mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
Removed verify_* commands and replaced them with a shell script to pass to hg bisect --command.
This commit is contained in:
parent
6b854b9187
commit
427cb559f5
@ -102,69 +102,3 @@ def update(ui, args, repo, clean=False, **opts):
|
||||
answers]+['']))
|
||||
return 1
|
||||
update = register_subcommand('up')(update)
|
||||
|
||||
|
||||
def verify_revision(ui, args, repo, force=False, **opts):
|
||||
"""verify a single converted revision
|
||||
Note: This wipes your working copy and then exports the corresponding
|
||||
Subversion into your working copy to verify. Use with caution.
|
||||
"""
|
||||
assert len(args) == 1
|
||||
if not force:
|
||||
assert repo.status(ignored=True,
|
||||
unknown=True) == ([], [], [], [], [], [], [])
|
||||
rev = int(args[0])
|
||||
wc_path = os.path.dirname(repo.path)
|
||||
svn_url = open(os.path.join(repo.path, 'svn', 'url')).read()
|
||||
svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser())
|
||||
util.wipe_all_files(wc_path)
|
||||
if update(ui, args, repo, clean=True) == 0:
|
||||
util.wipe_all_files(wc_path)
|
||||
br = repo.dirstate.branch()
|
||||
if br == 'default':
|
||||
br = None
|
||||
if br:
|
||||
diff_path = 'branches/%s' % br
|
||||
else:
|
||||
diff_path = 'trunk'
|
||||
svn.fetch_all_files_to_dir(diff_path, rev, wc_path)
|
||||
stat = repo.status(unknown=True)
|
||||
ignored = [s for s in stat[4]
|
||||
if '/.svn/' not in s and not s.startswith('.svn/')]
|
||||
stat = stat[0:4]
|
||||
if stat != ([], [], [], [],) or ignored != []:
|
||||
ui.status('Something is wrong with this revision.\n')
|
||||
return 2
|
||||
else:
|
||||
ui.status('OK.\n')
|
||||
return 0
|
||||
return 1
|
||||
verify_revision = register_subcommand('verify_revision')(verify_revision)
|
||||
|
||||
def verify_all_revisions(ui, args, repo, **opts):
|
||||
"""verify converted revisions; all or starting at a revision
|
||||
|
||||
Note: This is *extremely* abusive of the Subversion server. It exports every
|
||||
revision of the code one revision at a time.
|
||||
"""
|
||||
assert repo.status(ignored=True,
|
||||
unknown=True) == ([], [], [], [], [], [], [])
|
||||
start_rev = 0
|
||||
args = list(args)
|
||||
if args:
|
||||
start_rev = int(args.pop(0))
|
||||
revmap = util.parse_revmap(os.path.join(repo.path, 'svn', 'rev_map'))
|
||||
revs = sorted(revmap.keys())
|
||||
for revnum, br in revs:
|
||||
if revnum < start_rev:
|
||||
continue
|
||||
res = verify_revision(ui, [revnum], repo, force=True)
|
||||
if res == 0:
|
||||
print revnum, 'verfied'
|
||||
elif res == 1:
|
||||
print revnum, 'skipped'
|
||||
else:
|
||||
print revnum, 'failed'
|
||||
return 1
|
||||
return 0
|
||||
verify_all_revisions = register_subcommand('verify_all_revisions')(verify_all_revisions)
|
||||
|
10
tools/bisect-find-bad.sh
Executable file
10
tools/bisect-find-bad.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
/bin/rm -rf *
|
||||
svn export `hg svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` -`hg svn parent | sed 's/.*: //;s/ .*//'` . --force
|
||||
if [ `hg st | wc -l` = 0 ] ; then
|
||||
exit 0
|
||||
else
|
||||
hg revert --all
|
||||
hg purge
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user