1195 |
1195 |
1196 if not opts.get('clean') and not label: |
1196 if not opts.get('clean') and not label: |
1197 ui.write("%s\n" % repo.dirstate.branch()) |
1197 ui.write("%s\n" % repo.dirstate.branch()) |
1198 return |
1198 return |
1199 |
1199 |
1200 wlock = repo.wlock() |
1200 with repo.wlock(): |
1201 try: |
|
1202 if opts.get('clean'): |
1201 if opts.get('clean'): |
1203 label = repo[None].p1().branch() |
1202 label = repo[None].p1().branch() |
1204 repo.dirstate.setbranch(label) |
1203 repo.dirstate.setbranch(label) |
1205 ui.status(_('reset working directory to branch %s\n') % label) |
1204 ui.status(_('reset working directory to branch %s\n') % label) |
1206 elif label: |
1205 elif label: |
1218 others = [n for n, h, t, c in repo.branchmap().iterbranches() |
1217 others = [n for n, h, t, c in repo.branchmap().iterbranches() |
1219 if n != "default" and not c] |
1218 if n != "default" and not c] |
1220 if not others: |
1219 if not others: |
1221 ui.status(_('(branches are permanent and global, ' |
1220 ui.status(_('(branches are permanent and global, ' |
1222 'did you want a bookmark?)\n')) |
1221 'did you want a bookmark?)\n')) |
1223 finally: |
|
1224 wlock.release() |
|
1225 |
1222 |
1226 @command('branches', |
1223 @command('branches', |
1227 [('a', 'active', False, |
1224 [('a', 'active', False, |
1228 _('show only branches that have unmerged heads (DEPRECATED)')), |
1225 _('show only branches that have unmerged heads (DEPRECATED)')), |
1229 ('c', 'closed', False, _('show normal and closed branches')), |
1226 ('c', 'closed', False, _('show normal and closed branches')), |