mercurial/commands.py
changeset 219 8ff4532376a4
parent 214 2d60aa9bde0a
child 220 3113a94c1bff
equal deleted inserted replaced
218:06bc1ef248a6 219:8ff4532376a4
    66 def branch(ui, path):
    66 def branch(ui, path):
    67     '''branch from a local repository'''
    67     '''branch from a local repository'''
    68     # this should eventually support remote repos
    68     # this should eventually support remote repos
    69     os.system("cp -al %s/.hg .hg" % path)
    69     os.system("cp -al %s/.hg .hg" % path)
    70 
    70 
    71 def checkout(u, repo, changeset=None):
    71 def checkout(ui, repo, changeset=None):
    72     '''checkout a given changeset or the current tip'''
    72     '''checkout a given changeset or the current tip'''
       
    73     (c, a, d) = repo.diffdir(repo.root, repo.current)
       
    74     if c:
       
    75         ui.warn("aborting (outstanding changes in working directory)\n")
       
    76         sys.exit(1)
       
    77 
    73     node = repo.changelog.tip()
    78     node = repo.changelog.tip()
    74     if changeset:
    79     if changeset:
    75         node = repo.lookup(changeset)
    80         node = repo.lookup(changeset)
    76     repo.checkout(node)
    81     repo.checkout(node)
    77 
    82