--- a/hgext/convert/subversion.py Wed Jul 18 17:44:52 2007 -0700
+++ b/hgext/convert/subversion.py Wed Jul 18 19:47:22 2007 -0700
@@ -62,8 +62,10 @@
try:
# Support file://path@rev syntax. Useful e.g. to convert
# deleted branches.
- url, latest = url.rsplit("@", 1)
- latest = int(latest)
+ at = url.rfind('@')
+ if at >= 0:
+ latest = int(url[at+1:])
+ url = url[:at]
except ValueError, e:
pass
self.url = url
--- a/mercurial/commands.py Wed Jul 18 17:44:52 2007 -0700
+++ b/mercurial/commands.py Wed Jul 18 19:47:22 2007 -0700
@@ -2028,14 +2028,12 @@
for name, path in ui.configitems("paths"):
ui.write("%s = %s\n" % (name, path))
-def postincoming(ui, repo, modheads, optupdate, wasempty):
+def postincoming(ui, repo, modheads, optupdate):
if modheads == 0:
return
if optupdate:
- if wasempty:
- return hg.update(repo, repo.lookup('default'))
- elif modheads == 1:
- return hg.update(repo, repo.changelog.tip()) # update
+ if modheads == 1:
+ return hg.update(repo, None)
else:
ui.status(_("not updating, since new heads added\n"))
if modheads > 1:
@@ -2096,9 +2094,8 @@
error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
raise util.Abort(error)
- wasempty = repo.changelog.count() == 0
modheads = repo.pull(other, heads=revs, force=opts['force'])
- return postincoming(ui, repo, modheads, opts['update'], wasempty)
+ return postincoming(ui, repo, modheads, opts['update'])
def push(ui, repo, dest=None, **opts):
"""push changes to the specified destination
@@ -2662,7 +2659,6 @@
"""
fnames = (fname1,) + fnames
result = None
- wasempty = repo.changelog.count() == 0
for fname in fnames:
if os.path.exists(fname):
f = open(fname, "rb")
@@ -2671,7 +2667,7 @@
gen = changegroup.readbundle(f, fname)
modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
- return postincoming(ui, repo, modheads, opts['update'], wasempty)
+ return postincoming(ui, repo, modheads, opts['update'])
def update(ui, repo, node=None, rev=None, clean=False, date=None):
"""update working directory
--- a/mercurial/patch.py Wed Jul 18 17:44:52 2007 -0700
+++ b/mercurial/patch.py Wed Jul 18 19:47:22 2007 -0700
@@ -281,7 +281,7 @@
def internalpatch(patchname, ui, strip, cwd, files):
"""use builtin patch to apply <patchname> to the working directory.
returns whether patch was applied with fuzz factor."""
- fp = file(patchname)
+ fp = file(patchname, 'rb')
if cwd:
curdir = os.getcwd()
os.chdir(cwd)
@@ -303,7 +303,7 @@
self.fname = fname
self.ui = ui
try:
- fp = file(fname, 'r')
+ fp = file(fname, 'rb')
self.lines = fp.readlines()
self.exists = True
except IOError:
@@ -383,7 +383,7 @@
try: os.unlink(fname)
except:
pass
- fp = file(fname, 'w')
+ fp = file(fname, 'wb')
base = os.path.basename(self.fname)
fp.write("--- %s\n+++ %s\n" % (base, base))
for x in self.rej:
@@ -402,7 +402,7 @@
if st.st_nlink > 1:
os.unlink(dest)
except: pass
- fp = file(dest, 'w')
+ fp = file(dest, 'wb')
if st:
os.chmod(dest, st.st_mode)
fp.writelines(self.lines)
@@ -777,13 +777,13 @@
if count == 0:
return path.rstrip()
while count > 0:
- i = path.find(os.sep, i)
+ i = path.find('/', i)
if i == -1:
raise PatchError(_("unable to strip away %d dirs from %s") %
(count, path))
i += 1
# consume '//' in the path
- while i < pathlen - 1 and path[i] == os.sep:
+ while i < pathlen - 1 and path[i] == '/':
i += 1
count -= 1
return path[i:].rstrip()
--- a/mercurial/util_win32.py Wed Jul 18 17:44:52 2007 -0700
+++ b/mercurial/util_win32.py Wed Jul 18 19:47:22 2007 -0700
@@ -209,9 +209,9 @@
def __init__(self, name, mode='rb'):
access = 0
- if 'r' in mode or '+' in mode:
+ if 'r' in mode:
access |= win32file.GENERIC_READ
- if 'w' in mode or 'a' in mode:
+ if 'w' in mode or 'a' in mode or '+' in mode:
access |= win32file.GENERIC_WRITE
if 'r' in mode:
creation = win32file.OPEN_EXISTING
--- a/tests/test-tag Wed Jul 18 17:44:52 2007 -0700
+++ b/tests/test-tag Wed Jul 18 19:47:22 2007 -0700
@@ -29,14 +29,18 @@
hg tag -l 'xx:xx'
echo % issue 601
-mv .hg/localtags .hg/ltags
-head -1 .hg/ltags | tr -d '\n' > .hg/localtags
+python << EOF
+f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
+f = file('.hg/localtags', 'w'); f.write(last); f.close()
+EOF
cat .hg/localtags
hg tag -l localnewline
cat .hg/localtags
-mv .hgtags hgtags
-head -1 hgtags | tr -d '\n' > .hgtags
+python << EOF
+f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
+f = file('.hgtags', 'w'); f.write(last); f.close()
+EOF
hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
cat .hgtags
hg tag -d '1000000 0' newline