~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import patch
19
19
import stat
20
20
from bzrlib.trace import mutter
 
21
from bzrlib.osutils import rename
21
22
 
22
23
# XXX: mbp: I'm not totally convinced that we should handle conflicts
23
24
# as part of changeset application, rather than only in the merge
42
43
        newdict[value] = key
43
44
    return newdict
44
45
 
45
 
 
46
46
       
47
47
class ChangeUnixPermissions(object):
48
48
    """This is two-way change, suitable for file modification, creation,
92
92
    def __ne__(self, other):
93
93
        return not (self == other)
94
94
 
 
95
 
95
96
def dir_create(filename, conflict_handler, reverse):
96
97
    """Creates the directory, or deletes it if reverse is true.  Intended to be
97
98
    used with ReplaceContents.
117
118
        try:
118
119
            os.rmdir(filename)
119
120
        except OSError, e:
120
 
            if e.errno != 39:
 
121
            if e.errno != errno.ENOTEMPTY:
121
122
                raise
122
123
            if conflict_handler.rmdir_non_empty(filename) == "skip":
123
124
                return
124
125
            os.rmdir(filename)
125
126
 
126
 
                
127
 
            
128
127
 
129
128
class SymlinkCreate(object):
130
129
    """Creates or deletes a symlink (for use with ReplaceContents)"""
353
352
        status = patch.diff3(new_file, filename, base, other)
354
353
        if status == 0:
355
354
            os.chmod(new_file, os.stat(filename).st_mode)
356
 
            os.rename(new_file, filename)
 
355
            rename(new_file, filename)
357
356
            return
358
357
        else:
359
358
            assert(status == 1)
831
830
            if src_path is not None:
832
831
                src_path = os.path.join(dir, src_path)
833
832
                try:
834
 
                    os.rename(src_path, to_name)
 
833
                    rename(src_path, to_name)
835
834
                    temp_name[entry.id] = to_name
836
835
                except OSError, e:
837
836
                    if e.errno != errno.ENOENT:
874
873
            if old_path is None:
875
874
                continue
876
875
            try:
877
 
                os.rename(old_path, new_path)
 
876
                rename(old_path, new_path)
878
877
                changed_inventory[entry.id] = new_tree_path
879
878
            except OSError, e:
880
879
                raise Exception ("%s is missing" % new_path)