~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-05 06:49:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050405064902-0ddd0e6b29762088
new "rename" command

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
 
204
204
 
205
205
 
 
206
def cmd_rename(from_name, to_name):
 
207
    """Change the name of an entry.
 
208
 
 
209
usage: bzr rename FROM_NAME TO_NAME
 
210
 
 
211
examples:
 
212
  bzr rename frob.c frobber.c
 
213
  bzr rename src/frob.c lib/frob.c
 
214
 
 
215
It is an error if the destination name exists.
 
216
 
 
217
See also the 'move' command, which moves files into a different
 
218
directory without changing their name.
 
219
 
 
220
TODO: Some way to rename multiple files without invoking bzr for each
 
221
one?"""
 
222
    b = Branch('.')
 
223
    b.rename_one(b.relpath(from_name), b.relpath(to_name))
 
224
    
 
225
 
 
226
 
 
227
 
206
228
def cmd_renames(dir='.'):
207
229
    """Show list of renamed files.
208
230
 
728
750
    'mv':                     ['source$', 'dest'],
729
751
    'relpath':                ['filename'],
730
752
    'remove':                 ['file+'],
 
753
    'rename':                 ['from_name', 'to_name'],
731
754
    'renames':                ['dir?'],
732
755
    'root':                   ['filename?'],
733
756
    'status':                 [],