commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[2684] Initial svn2bzr revision.


From: Robert Millan
Subject: [2684] Initial svn2bzr revision.
Date: Fri, 06 Nov 2009 22:03:58 +0000

Revision: 2684
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2684
Author:   robertmh
Date:     2009-11-06 22:03:57 +0000 (Fri, 06 Nov 2009)
Log Message:
-----------
Initial svn2bzr revision.

Added Paths:
-----------
    people/robertmh/
    people/robertmh/svn2bzr/
    people/robertmh/svn2bzr/README
    people/robertmh/svn2bzr/bzr_timestamp_override.diff
    people/robertmh/svn2bzr/commit-from-log
    people/robertmh/svn2bzr/process_commit
    people/robertmh/svn2bzr/revert-svn-log-order
    people/robertmh/svn2bzr/svn2bzr

Added: people/robertmh/svn2bzr/README
===================================================================
--- people/robertmh/svn2bzr/README                              (rev 0)
+++ people/robertmh/svn2bzr/README      2009-11-06 22:03:57 UTC (rev 2684)
@@ -0,0 +1,3 @@
+Apply bzr_timestamp_override.diff, then use svn2bzr <url> <output-dir>.
+
+The other scripts are helpers used by svn2bzr.

Added: people/robertmh/svn2bzr/bzr_timestamp_override.diff
===================================================================
--- people/robertmh/svn2bzr/bzr_timestamp_override.diff                         
(rev 0)
+++ people/robertmh/svn2bzr/bzr_timestamp_override.diff 2009-11-06 22:03:57 UTC 
(rev 2684)
@@ -0,0 +1,16 @@
+
+Submitted in http://bugs.launchpad.net/bzr/+bug/283501
+
+--- /usr/share/pyshared/bzrlib/commit.py.bak   2009-11-06 21:11:37.000000000 
+0000
++++ /usr/share/pyshared/bzrlib/commit.py       2009-11-06 21:17:10.000000000 
+0000
+@@ -273,6 +273,10 @@
+         else:
+             self.specific_files = None
+             
++        v = os.environ.get('BZR_TIMESTAMP_OVERRIDE')
++        if v:
++            timestamp = eval (v)
++
+         self.allow_pointless = allow_pointless
+         self.revprops = revprops
+         self.message_callback = message_callback

Added: people/robertmh/svn2bzr/commit-from-log
===================================================================
--- people/robertmh/svn2bzr/commit-from-log                             (rev 0)
+++ people/robertmh/svn2bzr/commit-from-log     2009-11-06 22:03:57 UTC (rev 
2684)
@@ -0,0 +1,65 @@
+#!/bin/bash -e
+#
+# Copyright (C) 2009  Robert Millan
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+url="$1"
+dash_line="------------------------------------------------------------------------"
+
+die ()
+{
+  echo "$@" >&2
+  exit 1
+}
+
+process_commit=$(which process_commit || echo `dirname $0`/process_commit)
+
+bzr init
+
+st=0
+while read line ; do
+  case ${st} in
+    0)
+      if [ "${line}" != "${dash_line}" ] ; then
+        die "Unexpected input"
+      fi
+      st=1
+    ;;
+    1)
+      revision=`echo "${line}" | sed -e "s/^r\([0-9]*\) .*/\1/"`
+      username=`echo "${line}" | sed -e "s/^[^|]*| \([^ ]*\) .*/\1/"`
+      date=`echo "${line}" | sed -e "s/^[^|]*|[^|]*| \([^ ]* [^ ]* [^ ]*\) 
.*/\1/"`
+      date=`date +%s -d "${date}"`
+      unset message
+      read # empty line
+      st=2
+    ;;
+    2)
+      if [ "${line}" == "${dash_line}" ] ; then
+        ${process_commit} ${url} ${revision} ${username} "${date}" "${message}"
+        st=1
+        continue
+      fi
+      if [ "${message}" ] ; then
+        message="${message}
+${line}"
+      else
+        message="${line}"
+      fi
+    ;;
+  esac
+done
+
+exit 0


Property changes on: people/robertmh/svn2bzr/commit-from-log
___________________________________________________________________
Added: svn:executable
   + *

Added: people/robertmh/svn2bzr/process_commit
===================================================================
--- people/robertmh/svn2bzr/process_commit                              (rev 0)
+++ people/robertmh/svn2bzr/process_commit      2009-11-06 22:03:57 UTC (rev 
2684)
@@ -0,0 +1,72 @@
+#!/bin/bash -e
+#
+# Copyright (C) 2009  Robert Millan
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+url="$1"
+shift
+revision="$1"
+previous="$((${revision}-1))"
+shift
+username="$1"
+shift
+date="$1"
+shift
+message="$1"
+shift
+
+tmp=`mktemp`
+tmpdir=`mktemp -d`
+trap "rm -rf $tmp $tmpdir" EXIT
+
+die ()
+{
+  echo "$@" >&2
+  exit 1
+}
+
+echo
+echo "r${revision} | ${username} | `date -d @${date}` | `echo ${message} | cut 
-c -30`"
+
+if svn diff -r ${previous}:${revision} ${url} > ${tmp} ; then
+  patch -p0 < ${tmp} > /dev/null
+else
+  cat << EOF >&2
+
+It's OK, will assume ${revision} is the first revision.
+
+Exporting complete source tree for r${revision} ...
+EOF
+  svn export -r ${revision} ${url} ${tmpdir}/export > /dev/null
+  cp -a ${tmpdir}/export/* ./
+fi
+
+# This excludes zero-size files, but I can't think of a better way
+find . -type f -size 0 | grep -v "^\./\.bzr/" | while read i ; do
+  bzr rm --force --quiet "$i"
+done
+
+# Register new files (if they were added)
+bzr add --quiet
+
+# Actual commit
+if ! grep -q BZR_TIMESTAMP_OVERRIDE /usr/share/pyshared/bzrlib/commit.py ; then
+  echo "WARNING: unsupported BZR_TIMESTAMP_OVERRIDE, won't override 
timestamps" >&2
+fi
+if ! bzr diff --quiet ; then   # Avoid pointless commits
+  BZR_TIMESTAMP_OVERRIDE=${date} bzr commit -m "${message}" 
--author=${username}
+fi
+
+exit 0


Property changes on: people/robertmh/svn2bzr/process_commit
___________________________________________________________________
Added: svn:executable
   + *

Added: people/robertmh/svn2bzr/revert-svn-log-order
===================================================================
--- people/robertmh/svn2bzr/revert-svn-log-order                                
(rev 0)
+++ people/robertmh/svn2bzr/revert-svn-log-order        2009-11-06 22:03:57 UTC 
(rev 2684)
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Copyright (C) 2009  Robert Millan
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dash_line="------------------------------------------------------------------------"
+
+die ()
+{
+  echo "$@" >&2
+  exit 1
+}
+
+st=0
+(while read line ; do
+  case ${st} in
+    0)
+      if [ "${line}" != "${dash_line}" ] ; then
+        die "Unexpected input"
+      fi
+      st=1
+    ;;
+    1)
+      unset message
+      info_line="${line}"
+      read # empty line
+      st=2
+    ;;
+    2)
+      if [ "${line}" == "${dash_line}" ] ; then
+        echo "${dash_line}"
+        echo "${message}"
+        echo ""
+        echo "${info_line}"
+        st=1
+        continue
+      fi
+      if [ "${message}" ] ; then
+        message="${line}
+${message}"
+      else
+        message="${line}"
+      fi
+    ;;
+  esac
+done ; echo "${dash_line}") | tac
+
+exit 0


Property changes on: people/robertmh/svn2bzr/revert-svn-log-order
___________________________________________________________________
Added: svn:executable
   + *

Added: people/robertmh/svn2bzr/svn2bzr
===================================================================
--- people/robertmh/svn2bzr/svn2bzr                             (rev 0)
+++ people/robertmh/svn2bzr/svn2bzr     2009-11-06 22:03:57 UTC (rev 2684)
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+#
+# Copyright (C) 2009  Robert Millan
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+url="$1"
+out="$2"
+
+die ()
+{
+  echo "$@" >&2
+  exit 1
+}
+
+if [ "${out}" = "" ] ; then
+  die "Usage: $0 <url> <output-dir>"
+fi
+
+process_commit=$(which process_commit || echo `dirname $0`/process_commit)
+revert_svn_log_order=$(which revert-svn-log-order || echo `dirname 
$0`/revert-svn-log-order)
+commit_from_log=$(which commit-from-log || echo `dirname $0`/commit-from-log)
+
+(cd ${out} && svn log ${url} | ${revert_svn_log_order} | ${commit_from_log} 
${url})
+
+exit 0


Property changes on: people/robertmh/svn2bzr/svn2bzr
___________________________________________________________________
Added: svn:executable
   + *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]