# HG changeset patch
# User Paul Dehaye <pauloliviersage@gmail.com>
# Date 1187810218 -3600
# Node ID 75e49984c0dc372e2a52ff43aee4c99cfc65216b
# Parent c955b6d7531fab609de18d91f29bd0e65e7c2096
Fixed different options that were not quite right, also hg_sage.rename()
diff -r c955b6d7531f -r 75e49984c0dc sage/misc/hg.py
a
|
b
|
SAGE Interface to the HG/Mercurial Revis |
3 | 3 | |
4 | 4 | These functions make setup and use of source control with SAGE easier, using |
5 | 5 | the distributed Mercurial HG source control system. To learn about Mercurial, |
6 | | see http://www.selenic.com/mercurial/wiki/. |
| 6 | see http://www.selenic.com/mercurial/wiki/ , in particular UnderstandingMercurial . |
7 | 7 | |
8 | 8 | This system should all be fully usable from the SAGE notebook (except |
9 | 9 | for merging, currently). |
10 | | This system should all be mostly from the SAGE notebook. |
| 10 | This system should all be mostly usable from the SAGE notebook. |
11 | 11 | |
12 | 12 | \begin{itemize} |
13 | 13 | \item Use \code{hg_sage.record()} to record all of your changes. |
… |
… |
class HG: |
362 | 362 | |
363 | 363 | INPUT: |
364 | 364 | files -- list or string; name of file or directory. |
365 | | options -- string |
| 365 | options -- string (e.g., '--dry-run') |
366 | 366 | """ |
367 | 367 | if isinstance(files, str): |
368 | 368 | if ' ' in files: |
… |
… |
class HG: |
392 | 392 | |
393 | 393 | def rename(self, src, dest, options=''): |
394 | 394 | """ |
395 | | Move (rename) the given file. |
396 | | |
397 | | INPUT: |
398 | | src, dest -- strings that define files, relative to self.dir() |
| 395 | Move (rename) the given file, from src to dest. |
| 396 | This command takes effect in the next commit. |
| 397 | |
| 398 | INPUT: |
| 399 | src, dest -- strings that define a file, relative to self.dir() |
399 | 400 | options -- |
400 | 401 | -A --after record a rename that has already occurred |
401 | 402 | -f --force forcibly copy over an existing managed file |
402 | | -I --include include names matching the given patterns |
403 | | -X --exclude exclude names matching the given patterns |
404 | 403 | -n --dry-run do not perform actions, just print output |
405 | 404 | """ |
406 | | if isinstance(files, str): |
407 | | files = [files] |
408 | | for file in files: |
409 | | print "Moving %s --> %s"%file |
410 | | self('mv %s "%s"'%(options, file)) |
| 405 | print "Moving %s --> %s"%(src,dest) |
| 406 | self('mv %s "%s" "%s"'%(options, src,dest)) |
| 407 | |
411 | 408 | |
412 | 409 | move = rename |
413 | 410 | mv = rename |
… |
… |
class HG: |
456 | 453 | options += '-m ' |
457 | 454 | if patch: |
458 | 455 | options += '-p "%s"'%patch |
| 456 | if template: |
| 457 | options += '--template' |
459 | 458 | if include: |
460 | 459 | options += '-I "%s"'%include |
461 | 460 | if exclude: |
… |
… |
class HG: |
538 | 537 | -n --dry-run do not perform actions, just print output |
539 | 538 | """ |
540 | 539 | if not rev is None: |
541 | | options = ' -r %s %s'%(rev, files) |
| 540 | options = options +' -r %s %s'%(rev, files) |
542 | 541 | else: |
543 | | options = files |
| 542 | options = options + files |
544 | 543 | self('revert %s'%options) |
545 | 544 | |
546 | 545 | def dir(self): |
… |
… |
class HG: |
554 | 553 | Return the default 'master url' for this repository. |
555 | 554 | """ |
556 | 555 | return self.__url |
| 556 | |
557 | 557 | |
558 | 558 | def help(self, cmd=''): |
559 | 559 | r""" |
… |
… |
class HG: |
671 | 671 | INPUT: |
672 | 672 | options -- default: '' |
673 | 673 | 'tip' -- tip |
674 | | -b --branch merge with head of a specific branch |
675 | 674 | -f --force force a merge with outstanding changes |
676 | 675 | """ |
677 | 676 | self('merge %s'%options) |
… |
… |
class HG: |
696 | 695 | |
697 | 696 | INPUT: |
698 | 697 | options -- string (default: '') |
699 | | -b --branch checkout the head of a specific branch |
700 | | -C --clean overwrite locally modified files |
701 | | -f --force force a merge with outstanding changes |
| 698 | -C --clean overwrite locally modified files |
| 699 | -d --date tipmost revision matching date |
| 700 | -r --rev revision |
702 | 701 | """ |
703 | 702 | self('update %s'%options) |
704 | 703 | |
… |
… |
class HG: |
718 | 717 | |
719 | 718 | INPUT: |
720 | 719 | options -- string (default: '') |
721 | | -b --branches show branches |
722 | 720 | --style display using template map file |
723 | 721 | -r --rev show only heads which are descendants of rev |
724 | 722 | --template display with template |