##// END OF EJS Templates
mq: qinit -c creates a repo even after a regular qinit
Alexis S. L. Carvalho -
r4071:165abe55 default
parent child Browse files
Show More
@@ -1082,9 +1082,13 b' class queue:'
1082 self.push(repo, force=True, wlock=wlock)
1082 self.push(repo, force=True, wlock=wlock)
1083
1083
1084 def init(self, repo, create=False):
1084 def init(self, repo, create=False):
1085 if os.path.isdir(self.path):
1085 if not create and os.path.isdir(self.path):
1086 raise util.Abort(_("patch queue directory already exists"))
1086 raise util.Abort(_("patch queue directory already exists"))
1087 os.mkdir(self.path)
1087 try:
1088 os.mkdir(self.path)
1089 except OSError, inst:
1090 if inst.errno != errno.EEXIST or not create:
1091 raise
1088 if create:
1092 if create:
1089 return self.qrepo(create=True)
1093 return self.qrepo(create=True)
1090
1094
@@ -1467,13 +1471,16 b' def init(ui, repo, **opts):'
1467 r = q.init(repo, create=opts['create_repo'])
1471 r = q.init(repo, create=opts['create_repo'])
1468 q.save_dirty()
1472 q.save_dirty()
1469 if r:
1473 if r:
1470 fp = r.wopener('.hgignore', 'w')
1474 if not os.path.exists(r.wjoin('.hgignore')):
1471 print >> fp, 'syntax: glob'
1475 fp = r.wopener('.hgignore', 'w')
1472 print >> fp, 'status'
1476 fp.write('syntax: glob\n')
1473 print >> fp, 'guards'
1477 fp.write('status\n')
1474 fp.close()
1478 fp.write('guards\n')
1475 r.wopener('series', 'w').close()
1479 fp.close()
1480 if not os.path.exists(r.wjoin('series')):
1481 r.wopener('series', 'w').close()
1476 r.add(['.hgignore', 'series'])
1482 r.add(['.hgignore', 'series'])
1483 commands.add(ui, r)
1477 return 0
1484 return 0
1478
1485
1479 def clone(ui, source, dest=None, **opts):
1486 def clone(ui, source, dest=None, **opts):
@@ -40,6 +40,40 b' echo % qnew implies add'
40 hg -R c qnew test.patch
40 hg -R c qnew test.patch
41 hg -R c/.hg/patches st
41 hg -R c/.hg/patches st
42
42
43 echo '% qinit; qinit -c'
44 hg init d
45 cd d
46 hg qinit
47 hg qinit -c
48 # qinit -c should create both files if they don't exist
49 echo ' .hgignore:'
50 cat .hg/patches/.hgignore
51 echo ' series:'
52 cat .hg/patches/series
53 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
54 cd ..
55
56 echo '% qinit; <stuff>; qinit -c'
57 hg init e
58 cd e
59 hg qnew A
60 echo foo > foo
61 hg add foo
62 hg qrefresh
63 hg qnew B
64 echo >> foo
65 hg qrefresh
66 echo status >> .hg/patches/.hgignore
67 echo bleh >> .hg/patches/.hgignore
68 hg qinit -c
69 hg -R .hg/patches status
70 # qinit -c shouldn't touch these files if they already exist
71 echo ' .hgignore:'
72 cat .hg/patches/.hgignore
73 echo ' series:'
74 cat .hg/patches/series
75 cd ..
76
43 cd a
77 cd a
44
78
45 echo % qnew -m
79 echo % qnew -m
@@ -60,6 +60,26 b' A series'
60 A .hgignore
60 A .hgignore
61 A series
61 A series
62 A test.patch
62 A test.patch
63 % qinit; qinit -c
64 .hgignore:
65 syntax: glob
66 status
67 guards
68 series:
69 abort: repository already exists!
70 % qinit; <stuff>; qinit -c
71 adding A
72 adding B
73 A .hgignore
74 A A
75 A B
76 A series
77 .hgignore:
78 status
79 bleh
80 series:
81 A
82 B
63 % qnew -m
83 % qnew -m
64 foo bar
84 foo bar
65 % qrefresh
85 % qrefresh
General Comments 0
You need to be logged in to leave comments. Login now