##// END OF EJS Templates
merge with crew-stable
Dirkjan Ochtman -
r6884:11229144 merge default
parent child Browse files
Show More
@@ -997,7 +997,7 b' class svn_sink(converter_sink, commandli'
997 fp = open(hook, 'w')
997 fp = open(hook, 'w')
998 fp.write(pre_revprop_change)
998 fp.write(pre_revprop_change)
999 fp.close()
999 fp.close()
1000 util.set_flags(hook, "x")
1000 util.set_flags(hook, False, True)
1001
1001
1002 xport = transport.SvnRaTransport(url=geturl(path))
1002 xport = transport.SvnRaTransport(url=geturl(path))
1003 self.uuid = svn.ra.get_uuid(xport.ra)
1003 self.uuid = svn.ra.get_uuid(xport.ra)
@@ -1024,7 +1024,7 b' class svn_sink(converter_sink, commandli'
1024 # systematically is just as expensive and much simpler.
1024 # systematically is just as expensive and much simpler.
1025 was_exec = 'x' not in flags
1025 was_exec = 'x' not in flags
1026
1026
1027 util.set_flags(self.wjoin(filename), flags)
1027 util.set_flags(self.wjoin(filename), False, 'x' in flags)
1028 if was_exec:
1028 if was_exec:
1029 if 'x' not in flags:
1029 if 'x' not in flags:
1030 self.delexec.append(filename)
1030 self.delexec.append(filename)
@@ -544,8 +544,12 b' class localrepository(repo.repository):'
544 os.unlink(self.wjoin(filename))
544 os.unlink(self.wjoin(filename))
545 except OSError:
545 except OSError:
546 pass
546 pass
547 self.wopener(filename, 'w').write(data)
547 if 'l' in flags:
548 util.set_flags(self.wjoin(filename), flags)
548 self.wopener.symlink(data, filename)
549 else:
550 self.wopener(filename, 'w').write(data)
551 if 'x' in flags:
552 util.set_flags(self.wjoin(filename), False, True)
549
553
550 def wwritedata(self, filename, data):
554 def wwritedata(self, filename, data):
551 return self._filter("decode", filename, data)
555 return self._filter("decode", filename, data)
@@ -323,6 +323,10 b' def applyupdates(repo, action, wctx, mct'
323 updated += 1
323 updated += 1
324 else:
324 else:
325 merged += 1
325 merged += 1
326 util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
327 if f != fd and move and util.lexists(repo.wjoin(f)):
328 repo.ui.debug(_("removing %s\n") % f)
329 os.unlink(repo.wjoin(f))
326 elif m == "g": # get
330 elif m == "g": # get
327 flags = a[2]
331 flags = a[2]
328 repo.ui.note(_("getting %s\n") % f)
332 repo.ui.note(_("getting %s\n") % f)
@@ -348,7 +352,7 b' def applyupdates(repo, action, wctx, mct'
348 repo.ui.warn(" %s\n" % nf)
352 repo.ui.warn(" %s\n" % nf)
349 elif m == "e": # exec
353 elif m == "e": # exec
350 flags = a[2]
354 flags = a[2]
351 util.set_flags(repo.wjoin(f), flags)
355 util.set_flags(repo.wjoin(f), 'l' in flags, 'x' in flags)
352
356
353 return updated, merged, removed, unresolved
357 return updated, merged, removed, unresolved
354
358
@@ -1108,7 +1108,7 b' def updatedir(ui, repo, patches):'
1108 if ctype == 'ADD' and not os.path.exists(dst):
1108 if ctype == 'ADD' and not os.path.exists(dst):
1109 repo.wwrite(gp.path, '', flags)
1109 repo.wwrite(gp.path, '', flags)
1110 else:
1110 else:
1111 util.set_flags(dst, flags)
1111 util.set_flags(dst, 'l' in flags, 'x' in flags)
1112 cmdutil.addremove(repo, cfiles)
1112 cmdutil.addremove(repo, cfiles)
1113 files = patches.keys()
1113 files = patches.keys()
1114 files.extend([r for r in removes if r not in files])
1114 files.extend([r for r in removes if r not in files])
@@ -1069,7 +1069,7 b" if os.name == 'nt':"
1069 '''return False if pid dead, True if running or not known'''
1069 '''return False if pid dead, True if running or not known'''
1070 return True
1070 return True
1071
1071
1072 def set_flags(f, flags):
1072 def set_flags(f, l, x):
1073 pass
1073 pass
1074
1074
1075 def set_binary(fd):
1075 def set_binary(fd):
@@ -1216,16 +1216,18 b' else:'
1216 """check whether a file is executable"""
1216 """check whether a file is executable"""
1217 return (os.lstat(f).st_mode & 0100 != 0)
1217 return (os.lstat(f).st_mode & 0100 != 0)
1218
1218
1219 def set_flags(f, flags):
1219 def set_flags(f, l, x):
1220 s = os.lstat(f).st_mode
1220 s = os.lstat(f).st_mode
1221 x = "x" in flags
1222 l = "l" in flags
1223 if l:
1221 if l:
1224 if not stat.S_ISLNK(s):
1222 if not stat.S_ISLNK(s):
1225 # switch file to link
1223 # switch file to link
1226 data = file(f).read()
1224 data = file(f).read()
1227 os.unlink(f)
1225 os.unlink(f)
1228 os.symlink(data, f)
1226 try:
1227 os.symlink(data, f)
1228 except:
1229 # failed to make a link, rewrite file
1230 file(f, "w").write(data)
1229 # no chmod needed at this point
1231 # no chmod needed at this point
1230 return
1232 return
1231 if stat.S_ISLNK(s):
1233 if stat.S_ISLNK(s):
@@ -16,6 +16,7 b' import win32api'
16 import errno, os, sys, pywintypes, win32con, win32file, win32process
16 import errno, os, sys, pywintypes, win32con, win32file, win32process
17 import cStringIO, winerror
17 import cStringIO, winerror
18 import osutil
18 import osutil
19 import util
19 from win32com.shell import shell,shellcon
20 from win32com.shell import shell,shellcon
20
21
21 class WinError:
22 class WinError:
@@ -201,21 +202,17 b' def lookup_reg(key, valname=None, scope='
201 except ImportError:
202 except ImportError:
202 return None
203 return None
203
204
204 def query_val(scope, key, valname):
205 try:
206 keyhandle = OpenKey(scope, key)
207 return QueryValueEx(keyhandle, valname)[0]
208 except EnvironmentError:
209 return None
210
211 if scope is None:
205 if scope is None:
212 scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE)
206 scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE)
213 elif not isinstance(scope, (list, tuple)):
207 elif not isinstance(scope, (list, tuple)):
214 scope = (scope,)
208 scope = (scope,)
215 for s in scope:
209 for s in scope:
216 val = query_val(s, key, valname)
210 try:
217 if val is not None:
211 val = QueryValueEx(OpenKey(s, key), valname)[0]
218 return val
212 # never let a Unicode string escape into the wild
213 return util.tolocal(val.encode('UTF-8'))
214 except EnvironmentError:
215 pass
219
216
220 def system_rcpath_win32():
217 def system_rcpath_win32():
221 '''return default os-specific hgrc search path'''
218 '''return default os-specific hgrc search path'''
General Comments 0
You need to be logged in to leave comments. Login now