Mercurial > hg
comparison hgext/mq.py @ 4071:165abe554c80
mq: qinit -c creates a repo even after a regular qinit
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 09 Feb 2007 03:48:30 -0200 |
parents | 5b1f663ef86d |
children | 49237d6ae97d |
comparison
equal
deleted
inserted
replaced
4070:961ccb615cf7 | 4071:165abe554c80 |
---|---|
1080 repo.dirstate.forget(added) | 1080 repo.dirstate.forget(added) |
1081 self.pop(repo, force=True, wlock=wlock) | 1081 self.pop(repo, force=True, wlock=wlock) |
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 |
1091 def unapplied(self, repo, patch=None): | 1095 def unapplied(self, repo, patch=None): |
1092 if patch and patch not in self.series: | 1096 if patch and patch not in self.series: |
1465 repository.""" | 1469 repository.""" |
1466 q = repo.mq | 1470 q = repo.mq |
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): |
1480 '''clone main and patch repository at same time | 1487 '''clone main and patch repository at same time |
1481 | 1488 |