##// END OF EJS Templates
largefiles: test lfconvert error handling; remove redundant code
Greg Ward -
r15339:be1377d1 stable
parent child Browse files
Show More
@@ -43,26 +43,14 b' def lfconvert(ui, src, dest, *pats, **op'
43 else:
43 else:
44 tolfile = True
44 tolfile = True
45 size = lfutil.getminsize(ui, True, opts.get('size'), default=None)
45 size = lfutil.getminsize(ui, True, opts.get('size'), default=None)
46 try:
46 rsrc = hg.repository(ui, src)
47 rsrc = hg.repository(ui, src)
47 if not rsrc.local():
48 if not rsrc.local():
48 raise util.Abort(_('%s is not a local Mercurial repo') % src)
49 raise util.Abort(_('%s is not a local Mercurial repo') % src)
49
50 except error.RepoError, err:
50 ui.status(_('initializing destination %s\n') % dest)
51 ui.traceback()
51 rdst = hg.repository(ui, dest, create=True)
52 raise util.Abort(err.args[0])
52 if not rdst.local():
53 if os.path.exists(dest):
53 raise util.Abort(_('%s is not a local Mercurial repo') % dest)
54 if not os.path.isdir(dest):
55 raise util.Abort(_('destination %s already exists') % dest)
56 elif os.listdir(dest):
57 raise util.Abort(_('destination %s is not empty') % dest)
58 try:
59 ui.status(_('initializing destination %s\n') % dest)
60 rdst = hg.repository(ui, dest, create=True)
61 if not rdst.local():
62 raise util.Abort(_('%s is not a local Mercurial repo') % dest)
63 except error.RepoError:
64 ui.traceback()
65 raise util.Abort(_('%s is not a repo') % dest)
66
54
67 success = False
55 success = False
68 try:
56 try:
@@ -1,6 +1,7 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > largefiles =
3 > largefiles =
4 > share =
4 > [largefiles]
5 > [largefiles]
5 > minsize = 0.5
6 > minsize = 0.5
6 > patterns = **.dat
7 > patterns = **.dat
@@ -41,8 +42,24 b''
41 $ cat .hglf/a-large-file .hglf/another-large-file
42 $ cat .hglf/a-large-file .hglf/another-large-file
42 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
43 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
43 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
44 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
45 $ cd ..
46
47 "lfconvert" error cases
48 $ hg lfconvert nosuchrepo foo
49 abort: repository nosuchrepo not found!
50 [255]
51 $ hg share -q -U bigfile-repo shared
52 $ echo -n bogus > shared/.hg/sharedpath
53 $ hg lfconvert shared foo
54 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
55 [255]
56 $ hg lfconvert bigfile-repo largefiles-repo
57 initializing destination largefiles-repo
58 abort: repository largefiles-repo already exists!
59 [255]
44
60
45 Convert back to a normal (non-largefiles) repo
61 Convert back to a normal (non-largefiles) repo
62 $ cd largefiles-repo
46 $ hg lfconvert --to-normal . ../normal-repo
63 $ hg lfconvert --to-normal . ../normal-repo
47 initializing destination ../normal-repo
64 initializing destination ../normal-repo
48 $ cd ../normal-repo
65 $ cd ../normal-repo
General Comments 0
You need to be logged in to leave comments. Login now