~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-10-06 22:15:52 UTC
  • mfrom: (1185.13.2)
  • mto: This revision was merged to the branch mainline in revision 1420.
  • Revision ID: robertc@robertcollins.net-20051006221552-9b15c96fa504e0ad
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
    If branches have diverged, you can use 'bzr merge' to pull the text changes
324
324
    from one into the other.
325
325
    """
 
326
    takes_options = ['remember']
326
327
    takes_args = ['location?']
327
328
 
328
 
    def run(self, location=None):
 
329
    def run(self, location=None, remember=False):
329
330
        from bzrlib.merge import merge
330
331
        import tempfile
331
332
        from shutil import rmtree
337
338
            if stored_loc is None:
338
339
                raise BzrCommandError("No pull location known or specified.")
339
340
            else:
340
 
                print "Using last location: %s" % stored_loc
 
341
                print "Using saved location: %s" % stored_loc
341
342
                location = stored_loc
342
343
        cache_root = tempfile.mkdtemp()
343
344
        from bzrlib.errors import DivergedBranches
357
358
                    "  Try merge.")
358
359
                
359
360
            merge(('.', -1), ('.', old_revno), check_clean=False)
360
 
            if location != stored_loc:
 
361
            if stored_loc is None or remember:
361
362
                br_to.set_parent(location)
362
363
        finally:
363
364
            rmtree(cache_root)
997
998
    
998
999
    def run(self, message=None, file=None, verbose=True, selected_list=None,
999
1000
            unchanged=False):
1000
 
        from bzrlib.errors import PointlessCommit
 
1001
        from bzrlib.errors import PointlessCommit, ConflictsInTree
1001
1002
        from bzrlib.msgeditor import edit_commit_message
1002
1003
        from bzrlib.status import show_status
1003
1004
        from cStringIO import StringIO
1005
1006
        b = Branch.open_containing('.')
1006
1007
        if selected_list:
1007
1008
            selected_list = [b.relpath(s) for s in selected_list]
 
1009
 
1008
1010
            
1009
1011
        if message is None and not file:
1010
1012
            catcher = StringIO()
1034
1036
            # perhaps prepare the commit; get the message; then actually commit
1035
1037
            raise BzrCommandError("no changes to commit",
1036
1038
                                  ["use --unchanged to commit anyhow"])
 
1039
        except ConflictsInTree:
 
1040
            raise BzrCommandError("Conflicts detected in working tree.  "
 
1041
                'Use "bzr conflicts" to list, "bzr resolve FILE" to resolve.')
1037
1042
 
1038
1043
 
1039
1044
class cmd_check(Command):
1234
1239
    takes_args = ['branch?']
1235
1240
    takes_options = ['revision', 'force', 'merge-type']
1236
1241
 
1237
 
    def run(self, branch='.', revision=None, force=False, 
 
1242
    def run(self, branch=None, revision=None, force=False, 
1238
1243
            merge_type=None):
1239
1244
        from bzrlib.merge import merge
1240
1245
        from bzrlib.merge_core import ApplyMerge3
1241
1246
        if merge_type is None:
1242
1247
            merge_type = ApplyMerge3
1243
 
 
 
1248
        if branch is None:
 
1249
            branch = Branch.open_containing('.').get_parent()
 
1250
            if branch is None:
 
1251
                raise BzrCommandError("No merge location known or specified.")
 
1252
            else:
 
1253
                print "Using saved location: %s" % branch 
1244
1254
        if revision is None or len(revision) < 1:
1245
1255
            base = [None, None]
1246
1256
            other = [branch, -1]