/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/timestamp.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-09 21:42:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080709214224-r75k87r6a01pfc3h
Restore a real weave merge to 'bzr merge --weave'.

To do so efficiently, we only add the simple LCAs to the final weave
object, unless we run into complexities with the merge graph.
This gives the same effective result as adding all the texts,
with the advantage of not having to extract all of them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import calendar
18
18
import time
56
56
        offset = 0
57
57
    tt = time.gmtime(t + offset)
58
58
 
59
 
    return (osutils.weekdays[tt[6]] +
60
 
            time.strftime(" %Y-%m-%d %H:%M:%S", tt)
 
59
    return (time.strftime("%a %Y-%m-%d %H:%M:%S", tt)
61
60
            # Get the high-res seconds, but ignore the 0
62
61
            + ('%.9f' % (t - int(t)))[1:]
63
62
            + ' %+03d%02d' % (offset / 3600, (offset / 60) % 60))
101
100
    ...      break
102
101
 
103
102
    """
104
 
    # Weekday parsing is locale sensitive, so drop the weekday
105
 
    space_loc = date.find(' ')
106
 
    if space_loc == -1 or date[:space_loc] not in osutils.weekdays:
107
 
        raise ValueError(
108
 
            'Date string does not contain a day of week: %r' % date)
109
103
    # Up until the first period is a datestamp that is generated
110
104
    # as normal from time.strftime, so use time.strptime to
111
105
    # parse it
113
107
    if dot_loc == -1:
114
108
        raise ValueError(
115
109
            'Date string does not contain high-precision seconds: %r' % date)
116
 
    base_time = time.strptime(date[space_loc:dot_loc], " %Y-%m-%d %H:%M:%S")
 
110
    base_time = time.strptime(date[:dot_loc], "%a %Y-%m-%d %H:%M:%S")
117
111
    fract_seconds, offset = date[dot_loc:].split()
118
112
    fract_seconds = float(fract_seconds)
119
113
 
139
133
    if offset % 60 != 0:
140
134
        raise ValueError(
141
135
        "can't represent timezone %s offset by fractional minutes" % offset)
142
 
    # so that we don't need to do calculations on pre-epoch times,
 
136
    # so that we don't need to do calculations on pre-epoch times, 
143
137
    # which doesn't work with win32 python gmtime, we always
144
138
    # give the epoch in utc
145
139
    if secs == 0: